Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

stix_fonts_demo.py fails with bad refcount #1054

Merged
merged 1 commit into from

2 participants

Sébastien Fabbro Michael Droettboom
Sébastien Fabbro

with the Agg backend, trying to build docs, I get:

python stix_fonts_demo.py

python2.7: CXX/Python2/cxx_extensions.cxx:1320: virtual Py::PythonExtensionBase::~PythonExtensionBase(): Assertion `ob_refcnt == 0' failed.
Aborted (core dumped)

looks like commit 85af0c0#src/ft2font.cpp is the culprit

Michael Droettboom
Owner

I can't reproduce this here, but it may be something unique about your system.

I believe that commit you reference fixes this bug (which I have seen before) rather than creates it. Are you sure you're running master and have rebuilt from scratch (by deleting the "build" directory before rebuilding)? If you're certain of that, have you tried building either of the parent commits of that commit to confirm that it works before and not after?

Sébastien Fabbro

i can reproduce with matplotlib-1.1.1 and without -DNDEBUG. the git master actually seems to works.

it is confusing, because a fix was committed back in 2010 with:

b5ce842

but later on was overwritten with the commit refered in the first comment.

Michael Droettboom
Owner

I see. Thanks for the additional info. I'll look at the 1.1.x branch and see what I can discover there.

Michael Droettboom
Owner

The fix in b5ce842 was no longer needed following an update to PyCXX.

Strangely, I'm still unable to reproduce on 1.1.1 without -NDEBUG:

CFLAGS=-UNDEBUG python setup.py install

This sometimes happens when things don't get fully rebuilt after switching branches.

Sébastien Fabbro

CXXFLAGS need to be set as well

Michael Droettboom
Owner

Thanks -- just tried that. Due to a bug in how distutils handles CXXFLAGS, it doesn't actually matter, but for good measure it makes sense. Unfortunately, I'm still not able to reproduce.

Michael Droettboom
Owner

What platform are you on?

Sébastien Fabbro

i am on gentoo x86_64, but i did check on ubuntu 12.04 x86_64 to make sure it was not distro specific.
to reproduce from a vanilla matplotlib-1.1.1 tar ball, i do:

CXXFLAGS=-UNDEBUG CFLAGS=-UNDEBUG python setup.py build
cp doc/matplotlibrc .
PYTHONPATH=build/lib.linux-x86_64-2.7 python examples/pylab_examples/stix_fonts_demo.py

Michael Droettboom mdboom merged commit 8089e04 into from
Michael Droettboom
Owner

Right you are. The missing piece was the matplotlibrc from the doc directory.

With debugging turned on, it looks like those ob_refcnt-- operations are required on both 1.1.x and master. Thanks for finding this. Without debugging turned on, these are probably silently leaking.

Michael Droettboom
Owner

Right you are. The missing piece was the matplotlibrc from the doc directory.

With debugging turned on, it looks like those ob_refcnt-- operations are required on both 1.1.x and master. Thanks for finding this. Without debugging turned on, these are probably silently leaking.

Michael Droettboom mdboom deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/ft2font.cpp
5 src/ft2font.cpp
View
@@ -870,24 +870,28 @@ FT2Font::FT2Font(std::string facefile) :
{
std::ostringstream s;
s << "Could not load facefile " << facefile << "; Unknown_File_Format" << std::endl;
+ ob_refcnt--;
throw Py::RuntimeError(s.str());
}
else if (error == FT_Err_Cannot_Open_Resource)
{
std::ostringstream s;
s << "Could not open facefile " << facefile << "; Cannot_Open_Resource" << std::endl;
+ ob_refcnt--;
throw Py::RuntimeError(s.str());
}
else if (error == FT_Err_Invalid_File_Format)
{
std::ostringstream s;
s << "Could not open facefile " << facefile << "; Invalid_File_Format" << std::endl;
+ ob_refcnt--;
throw Py::RuntimeError(s.str());
}
else if (error)
{
std::ostringstream s;
s << "Could not open facefile " << facefile << "; freetype error code " << error << std::endl;
+ ob_refcnt--;
throw Py::RuntimeError(s.str());
}
@@ -904,6 +908,7 @@ FT2Font::FT2Font(std::string facefile) :
{
std::ostringstream s;
s << "Could not set the fontsize for facefile " << facefile << std::endl;
+ ob_refcnt--;
throw Py::RuntimeError(s.str());
}
Something went wrong with that request. Please try again.