Pyrex-0.9.3: definition mismatch with distutils of Python24

Discussion in 'Python' started by Martin Bless, Jan 13, 2005.

  1. Martin Bless

    Martin Bless Guest

    Now that I've got my extension building machine using the VC++ Toolkit
    2003 up and running I'm keen on using Pyrex (Pyrex-0.9.3,
    Python-2.4.0).

    But the definition of the swig_sources() method seems to have changed.

    When I try to build the examples from Pyrex I get a TypeError:


    c:\Pyrex-0.9.3\Demos> python Setup.py build_ext --inplace
    running build_ext
    building 'primes' extension
    [...]
    File "C:\Python24\lib\distutils\command\build_ext.py", line 442, in
    build_extension
    sources = self.swig_sources(sources, ext)
    TypeError: swig_sources() takes exactly 2 arguments (3 given)


    I can see that Pyrex.Distutils.build_ext.py subclasses
    distutils.command.build_ext.build_ext, and the number of arguments of
    the swig_sources method seems to have changed.

    Pyrex uses:

    def swig_sources (self, sources):

    whereas the distutils use:

    def swig_sources (self, sources, extension):

    If I just add the "extension" arg to the Pyrex definitions everything
    seems to work. But I have to admit that I don't really know what I'm
    doing here and I feel sorry I can't contribute more than just
    reporting the error.

    mb - Martin Bless
     
    Martin Bless, Jan 13, 2005
    #1
    1. Advertisements

  2. (Martin Bless) writes:

    > Now that I've got my extension building machine using the VC++ Toolkit
    > 2003 up and running I'm keen on using Pyrex (Pyrex-0.9.3,
    > Python-2.4.0).
    >
    > But the definition of the swig_sources() method seems to have changed.
    >
    > When I try to build the examples from Pyrex I get a TypeError:
    >
    >
    > c:\Pyrex-0.9.3\Demos> python Setup.py build_ext --inplace
    > running build_ext
    > building 'primes' extension
    > [...]
    > File "C:\Python24\lib\distutils\command\build_ext.py", line 442, in
    > build_extension
    > sources = self.swig_sources(sources, ext)
    > TypeError: swig_sources() takes exactly 2 arguments (3 given)
    >
    >
    > I can see that Pyrex.Distutils.build_ext.py subclasses
    > distutils.command.build_ext.build_ext, and the number of arguments of
    > the swig_sources method seems to have changed.
    >
    > Pyrex uses:
    >
    > def swig_sources (self, sources):
    >
    > whereas the distutils use:
    >
    > def swig_sources (self, sources, extension):
    >
    > If I just add the "extension" arg to the Pyrex definitions everything
    > seems to work. But I have to admit that I don't really know what I'm
    > doing here and I feel sorry I can't contribute more than just
    > reporting the error.


    Yep, that's it. Greg must know now, it's been reported a few times.
    You'll want to change it to

    def swig_sources(self, sources, extension=None):

    so that if you use an older python it won't complain about missing
    arguments.

    --
    |>|\/|<
    /--------------------------------------------------------------------------\
    |David M. Cooke
    |cookedm(at)physics(dot)mcmaster(dot)ca
     
    David M. Cooke, Jan 14, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?iso-8859-1?Q?Fran=E7ois?= Pinard

    Re: Pyrex without Python (was Re: calling Pyrex results from C)

    =?iso-8859-1?Q?Fran=E7ois?= Pinard, Jan 21, 2004, in forum: Python
    Replies:
    3
    Views:
    479
    A.M. Kuchling
    Jan 21, 2004
  2. A. B., Khalid

    How big is python24.dll?

    A. B., Khalid, Jul 12, 2004, in forum: Python
    Replies:
    5
    Views:
    564
    Miki Tebeka
    Jul 13, 2004
  3. Delaney, Timothy C (Timothy)

    RE: How big is python24.dll?

    Delaney, Timothy C (Timothy), Jul 13, 2004, in forum: Python
    Replies:
    12
    Views:
    870
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Jul 14, 2004
  4. TPJ
    Replies:
    1
    Views:
    359
    Diez B. Roggisch
    Nov 9, 2005
  5. timw.google
    Replies:
    1
    Views:
    753
    Serge Orlov
    May 11, 2006
  6. Greg Ewing
    Replies:
    2
    Views:
    530
    Dieter Maurer
    Jun 29, 2006
  7. Justin S Bayer
    Replies:
    0
    Views:
    547
    Justin S Bayer
    Mar 26, 2008
  8. Luis Alberto Zarrabeitia Gomez

    distutils, No module named numpy.distutils.fcompiler.conv_template

    Luis Alberto Zarrabeitia Gomez, Mar 30, 2009, in forum: Python
    Replies:
    0
    Views:
    1,540
    Luis Alberto Zarrabeitia Gomez
    Mar 30, 2009
Loading...