Lisandro Dalcin | 29 Mar 12:17 2015
Picon

[Cython] "long long" versus "PY_LONG_LONG"

At some point Cython lost the ability of using PY_LONG_LONG instead of
"long long" in generated C code. The big offenders are the following
two files:

Cython/Utility/Overflow.c
Cython/Utility/TypeConversion.c

Do we want to continue using PY_LONG_LONG? Otherwise, what about
Microsoft compilers? Going back to PY_LONG_LONG everywhere is quite
easy right now, let me know and I'll contribute the patch for the
upcoming 0.22.1 release (if that ever happens).

--

-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459
Daniel Grunwald | 17 Mar 18:24 2015

[Cython] Generated function has invalid name when converting from python object to C struct defined in C++ namespace

Hello,

I have Cython code like this:
     cdef extern from "cpp_library.h" namespace "CppLibrary":
         struct SomeStruct:
             int i

         void do_with_struct(SomeStruct s)

     def run():
         do_with_struct(object())

With cython 0.21.1, invalid C++ code is generated:
    struct CppLibrary::SomeStruct;
    static struct CppLibrary::SomeStruct 
__pyx_convert__from_py_CppLibrary::SomeStruct(PyObject *);

With cython master, a compiler error occurs:
      <at> cname("__pyx_convert__from_py_CppLibrary::SomeStruct")
     cdef SomeStruct __pyx_convert__from_py_CppLibrary::SomeStruct(obj) 
except *:
                                                      ^
     FromPyStructUtility:11:50: Expected an identifier or literal

Cython should mangle the struct name to ensure the helper function has a 
valid name.

Regards,

--

-- 
(Continue reading)

Nathan Goldbaum | 11 Mar 06:27 2015
Picon

[Cython] Cython magic annotate option is broken under IPython 3.0

Hi all,

To reproduce this issue, be on cython 0.22 and IPython 3.0 and run the following notebook:


Googling the error returns some several year old discussions in IPython related to the autoreload magic and I'm not sure if that is a red herring here:


For how I'm working around this by calling cython at the command line in my notebook and then loading the annotated HTML with an IFrame.

Thanks for your help!
<div><div dir="ltr">
<span>Hi all,</span><div><br></div>
<div>To reproduce this issue, be on cython 0.22 and IPython 3.0 and run the following notebook:</div>
<div><br></div>
<div>
<a href="http://nbviewer.ipython.org/gist/ngoldbaum/855a629d997aa7959254" target="_blank">http://nbviewer.ipython.org/gist/ngoldbaum/855a629d997aa7959254</a><br>
</div>
<div><br></div>
<div>Googling the error returns some several year old discussions in IPython related to the autoreload magic and I'm not sure if that is a red herring here:</div>
<div><br></div>
<div>
<a href="http://mail.scipy.org/pipermail/ipython-dev/2012-May/009288.html" target="_blank">http://mail.scipy.org/pipermail/ipython-dev/2012-May/009288.html</a><br>
</div>
<div><br></div>
<div>For how I'm working around this by calling cython at the command line in my notebook and then loading the annotated HTML with an IFrame.</div>
<div><br></div>
<div>Thanks for your help!</div>
</div></div>
Jeroen Demeyer | 7 Mar 09:58 2015
Picon

[Cython] Proposal: extern implementations of functions

Hello Cython developers,

I would like to propose a new mechanism to implement functions in an 
external .c file. The goal is to solve the problem I was having in
https://groups.google.com/forum/#!topic/cython-users/TsbBNyvwZn4

With the attached patch, you can do the following:

* in foo.pxd, declare the function as usual:
cdef void myfunc()

* in foo.c, actually implement the function:
static void myfunc()
{
     /* ... */
}

* in foo.pyx, declare the function extern:
cdef extern from "foo.c":
     void myfunc()

With my patch, the extern declaration in foo.pyx will be interpreted as 
implementing the function. Therefore, myfunc() is now available in the 
module foo, and it can also be cimported by other modules.

What do you think of this proposed feature?

Jeroen.
Hello Cython developers,

I would like to propose a new mechanism to implement functions in an 
external .c file. The goal is to solve the problem I was having in
https://groups.google.com/forum/#!topic/cython-users/TsbBNyvwZn4

With the attached patch, you can do the following:

* in foo.pxd, declare the function as usual:
cdef void myfunc()

* in foo.c, actually implement the function:
static void myfunc()
{
     /* ... */
}

* in foo.pyx, declare the function extern:
cdef extern from "foo.c":
     void myfunc()

With my patch, the extern declaration in foo.pyx will be interpreted as 
implementing the function. Therefore, myfunc() is now available in the 
module foo, and it can also be cimported by other modules.

What do you think of this proposed feature?

Jeroen.
Lisandro Dalcin | 17 Mar 21:10 2015
Picon

[Cython] Sorry: 0.22.x and master broken

Folks, I'm very sorry. In an attempt to fix issues with PyPy3, I
pushed a fix to 0.22.x
(https://github.com/cython/cython/commit/8573e7898a27ef607a3264909cc3bf24d4e13959)
and merged to master, but now one test is failing with CPython 3
(https://travis-ci.org/cython/cython/jobs/54762494). I did not run the
full test suite with python3, my fault.

I'll look at this issue tomorrow and push a fix ASAP.

--

-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459
Nathaniel Smith | 14 Mar 09:17 2015

[Cython] Cython inserting unqualified module name into sys.module on python 3?

Hi all,

Can anyone shed any light on this?

https://github.com/numpy/numpy/issues/5680

-n

--

-- 
Nathaniel J. Smith -- http://vorpus.org
Lisandro Dalcin | 10 Mar 15:28 2015
Picon

[Cython] Py3, TypeConversion.c, PyLong internals

Robert, please look at this line:
https://github.com/cython/cython/blob/0.22.x/Cython/Utility/TypeConversion.c#L559

You are still using a PyLong internal detail to test for signedness.
I'm getting a strange error with PyPy3 that might be related to this,
see this traceback:
https://travis-ci.org/mpi4py/mpi4py/jobs/53793609#L5650

The code generating this traceback is linked below,
the__setitem__method of the variable "m" is coded to only accept
"usigned char" values.

https://bitbucket.org/mpi4py/mpi4py/src/86e4235ee2ec31832031ce020421810c51d4910b/test/test_rma.py?at=master#cl-13

Any suggestions about how to check signedness in Python 3 (CPython and
PyPy) without using Py_SIZE() ?

--

-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459
Lisandro Dalcin | 8 Mar 20:25 2015
Picon

[Cython] PyPy3 fixes

1) Stefan, I had to push this fix, just to be sure, please double check.

https://github.com/cython/cython/commit/6bd3f7b9e494d1259082aecfc0366da15fc105ec

2) PyPy3 defines some legacy (Py2) Py_TPFLAGS_XXX values. Do you like
the following fix? IOW, I check if the value is #define'd, if not I
#define it to 0 (zero):

diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index 6477fb2..3ae8a0c 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
 <at>  <at>  -59,13 +59,16  <at>  <at> 
   #define __Pyx_DefaultClassType PyType_Type
 #endif

-#if PY_MAJOR_VERSION >= 3
+#if !defined(Py_TPFLAGS_CHECKTYPES)
   #define Py_TPFLAGS_CHECKTYPES 0
+#endif
+#if !defined(Py_TPFLAGS_HAVE_INDEX)
   #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+#if !defined(Py_TPFLAGS_HAVE_NEWBUFFER)
   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
 #endif
-
-#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
+#if !defined(Py_TPFLAGS_HAVE_FINALIZE)
   #define Py_TPFLAGS_HAVE_FINALIZE 0
 #endif

--

-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459
Kai Huuhko | 6 Mar 06:55 2015
Picon

[Cython] PyMethod_New compatibility

This change:
https://github.com/cython/cython/commit/499d98628a8a929ed065bf38ee4ec6405145e092

removed compatibility code for PyMethod_New to have the same signature
with both py2 and py3. Is there an alternative way - that is py2/py3
compatible - within a code block to bind functions to an instance?

For reference, we use it here:
https://git.enlightenment.org/bindings/python/python-efl.git/tree/efl/evas/efl.evas_object_smart.pxi#n431
Stefan Behnel | 27 Feb 10:59 2015
Picon

[Cython] PEP 448: Additional Unpacking Generalizations

Looks like a nice goody for Cython users, too:

https://www.python.org/dev/peps/pep-0448/

Requires grammar changes, but otherwise could be done with a transform, I
guess, by mapping the unpacking to list/tuple concatenations and dict updates.

Stefan
Raniere Silva | 20 Feb 21:31 2015
Picon

[Cython] ANN: SciPy Latin América 2015 - Call for Proposals

*Call for Proposals*

*SciPy Latin América 2015*, the third annual Scientific Computing with
Python Conference, will be held this *May 20-22* in *Posadas, Misiones,
Argentina*.

SciPy is a community dedicated to the advancement of scientific computing
through open source Python software for mathematics, science, and
engineering. The annual SciPy Conferences allows participants from
academic, commercial, and governmental organizations to showcase their
latest projects, learn from skilled users and developers, and collaborate
on code development.

*Proposals are now being accepted for SciPy Latin América 2015*.

Presentation content can be at a novice, intermediate or advanced level.
Talks will run 30-40 min and hands-on tutorials will run 100-120 min. We
also receive proposal for posters. For more information about the different
types of proposal, see below the "*Different types of Communication*"
section.

*How to Submit?*

   1. Register for an account on http://conf.scipyla.org/user/register
   2. Submit your proposal at http://conf.scipyla.org/activity/propose

*Important Dates*

   - *April 6th*: Talks, poster, tutorial submission deadline.
   - *April 20th*: Notification Talks / Posters / Tutorial accepted.
   - *May 20th-22nd*: SciPy Latin América 2015.

*Different types of Communication*

*Talks*: These are the traditional talk sessions given during the main
conference days. They're mostly 30 minutes long with 5 min for questions.
If you think you have a topic but aren't sure how to propose it, contact
our program committee and we'll work with you. We'd love to help you come
up with a great proposal.

*Tutorials*: We are looking for tutorials that can grow this community at
any level. We aim for tutorials that will advance Scientific Python,
advance this community, and shape the future. They're are 100-120 minutes
long, but if you think you need more than one slot, you can split the
content and submit two self-contained proposals.

*Posters*: The poster session provides a more interactive, attendee-driven
presentation than the speaker-driven conference talks. Poster presentations
have fostered extensive discussions on the topics, with many that have gone
on much longer than the actual "session" called for. The idea is to present
your topic on poster board and as attendees mingle through the rows, they
find your topic, read through what you've written, then strike up a
discussion on it. It's as simple as that. You could be doing Q&A in the
first minute of the session with a group of 10 people.

*Lightning Talks*: Want to give a talk, but do not have enough material for
a full talk? These talks are, at max, 5 minute talks done in quick
succession in the main hall. No need to fill the whole slot, though!

-- 
*The SciPy LA 2015 Program **Committee*
*Call for Proposals*

*SciPy Latin América 2015*, the third annual Scientific Computing with
Python Conference, will be held this *May 20-22* in *Posadas, Misiones,
Argentina*.

SciPy is a community dedicated to the advancement of scientific computing
through open source Python software for mathematics, science, and
engineering. The annual SciPy Conferences allows participants from
academic, commercial, and governmental organizations to showcase their
latest projects, learn from skilled users and developers, and collaborate
on code development.

*Proposals are now being accepted for SciPy Latin América 2015*.

Presentation content can be at a novice, intermediate or advanced level.
Talks will run 30-40 min and hands-on tutorials will run 100-120 min. We
also receive proposal for posters. For more information about the different
types of proposal, see below the "*Different types of Communication*"
section.

*How to Submit?*

   1. Register for an account on http://conf.scipyla.org/user/register
   2. Submit your proposal at http://conf.scipyla.org/activity/propose

*Important Dates*

   - *April 6th*: Talks, poster, tutorial submission deadline.
   - *April 20th*: Notification Talks / Posters / Tutorial accepted.
   - *May 20th-22nd*: SciPy Latin América 2015.

*Different types of Communication*

*Talks*: These are the traditional talk sessions given during the main
conference days. They're mostly 30 minutes long with 5 min for questions.
If you think you have a topic but aren't sure how to propose it, contact
our program committee and we'll work with you. We'd love to help you come
up with a great proposal.

*Tutorials*: We are looking for tutorials that can grow this community at
any level. We aim for tutorials that will advance Scientific Python,
advance this community, and shape the future. They're are 100-120 minutes
long, but if you think you need more than one slot, you can split the
content and submit two self-contained proposals.

*Posters*: The poster session provides a more interactive, attendee-driven
presentation than the speaker-driven conference talks. Poster presentations
have fostered extensive discussions on the topics, with many that have gone
on much longer than the actual "session" called for. The idea is to present
your topic on poster board and as attendees mingle through the rows, they
find your topic, read through what you've written, then strike up a
discussion on it. It's as simple as that. You could be doing Q&A in the
first minute of the session with a group of 10 people.

*Lightning Talks*: Want to give a talk, but do not have enough material for
a full talk? These talks are, at max, 5 minute talks done in quick
succession in the main hall. No need to fill the whole slot, though!

--

-- 
*The SciPy LA 2015 Program **Committee*

Gmane