Antoine Fressancourt | 11 Mar 12:09 2016
Picon

Cython and LIFO queueing

Hello,

I am new to Cython, and I am coming to it in order to work on the optimization of an algorithm I have coded in Python to look after performance improvements. Basically, the algorithm I am trying to optimize with Cython is an elaborated path search in a graph represented as a dictionary. I am extensively using a double-ended queue in the python implementation of the algorithm. 

In order to evaluate the potential gain using Cython, I have looked at potential methods to build a LIFO queue. I have tried several things:
* Using the pure Python collection.deque object in a .pyx file while declaring other varaibles using "cdef", and generating a standalone executable
* Using the C implementation of queue in a Cython-generated library then called by a Python file
* Using the C implementation of queue in a Cython-generated executable.

As my goal would be to compile the executable on one system and be able to run it on several machines in a clusetr on which I can't install a compilation toolchain, option 1 or 3 would have my favor. Yet, in my preliminary tests, I have found that running the pure Python program was faster than my three tests. 

This is why I am trying to reach the community to see if I got something wrong.

The tests I have done can be found here (Test 3, 4 and 5):
https://github.com/afressancourt/CythonTests

Thanks in advance for your help on the matter,

Antoine Fressancourt

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raghav R V | 16 Mar 15:07 2016
Picon
Gravatar

Defining and using a vector of maps in cython (using libcpp)

Hi,

I need to store a list of dictionaries in cython and decided to go with the `vector[map[string, int]]` setup as I don't know the size of the list.

Currently I'm trying the below

%%cython

# distutils: language = c++

from libcpp.string cimport string
from libcpp.map cimport map
from libcpp.vector cimport vector

cdef vector[map[string, int]] categories
cdef map[string, int]* categories_i

for i in range(2):
    categories_i = new map[string, int]
    categories_i[<string>'foo'] = 1
    categories_i[<string>'bar'] = 2
    categories.pushback(categories_i)

print categories[0][<string>'foo']

But I get a 

"Expected an identifier before '='" error... I understand that the error stems from the creation of the new map object (categories_i = new map[string, int]) but unsure how I should proceed.

Or is there an easier way to declare and use the python equivalent of list of dicts in cython?

Thanks,

R

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Error compiling project under WinPython / GCC, MinGW

Hi Folks,

i'm currently trying to compile my project Bass4Py using WinPython for
Python 2.7 which contains some sort of gcc or mingw to compile C code.
I tried first using the latest stable release Cython 0.23.4, since
this failed I tried the latest master and failed anyway. Here's the
building log using the latest master (I saw that the warnings at the
top are already known to you, they aren't relevant for this).

warning: Bass4Py\bass.pyx:68:1: 'property CPU:' syntax is deprecated,
use ' <at> property'
warning: Bass4Py\bass.pyx:71:1: 'property Device:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:76:1: 'property Error:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:79:1: 'property Version:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:82:1: 'property NetAgent:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:87:1: 'property NetProxy:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:92:1: 'property Algorithm3D:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:97:1: 'property Airplay:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:102:1: 'property AsyncBuffer:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:107:1: 'property Buffer:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:112:1: 'property CurveVolume:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:117:1: 'property CurvePan:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:122:1: 'property DeviceBuffer:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:127:1: 'property DefaultDevice:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:132:1: 'property FloatDsp:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:137:1: 'property MusicVolume:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:142:1: 'property SampleVolume:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:147:1: 'property StreamVolume:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:152:1: 'property Video:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:157:1: 'property VirtualChannels:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:162:1: 'property NetBuffer:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:167:1: 'property NetPassive:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:172:1: 'property NetPlaylist:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:177:1: 'property NetPrebuf:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:182:1: 'property NetTimeout:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:187:1: 'property NetReadTimeout:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:192:1: 'property OggPrescan:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:197:1: 'property PauseNoplay:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:202:1: 'property RecordBuffer:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:207:1: 'property SRC:' syntax is deprecated,
use ' <at> property'
warning: Bass4Py\bass.pyx:212:1: 'property SRCSample:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:217:1: 'property Unicode:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:222:1: 'property UpdatePeriod:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:227:1: 'property UpdateThreads:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:232:1: 'property Verify:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:237:1: 'property NetVerify:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:242:1: 'property VistaSpeakers:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bass.pyx:247:1: 'property VistaTruepos:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:111:1: 'property DefaultFrequency:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:116:1: 'property Channels:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:121:1: 'property Flags:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:126:1: 'property Type:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:131:1: 'property Resolution:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:136:1: 'property Plugin:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:144:1: 'property Name:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:149:1: 'property Sample:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:157:1: 'property Position:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:164:2: 'property EAXMix:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:167:1: 'property CPU:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:170:1: 'property Frequency:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:173:1: 'property Active:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:176:1: 'property Amplify:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:179:1: 'property BPM:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:182:1: 'property PanSeparation:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:185:1: 'property Scaler:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:188:1: 'property Speed:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:191:1: 'property ChannelVolumes:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:194:1: 'property GlobalVolume:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:197:1: 'property InstrumentVolumes:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:200:1: 'property NetResume:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:207:1: 'property Pan:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:210:1: 'property SRC:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:213:1: 'property Volume:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:216:1: 'property Loop:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:221:1: 'property AutoFree:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:226:1: 'property RestrictDownload:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:231:1: 'property InterpolationNone:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:236:1: 'property InterpolationSinc:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:241:1: 'property RampNormal:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:246:1: 'property RampSensitive:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:251:1: 'property Surround:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:256:1: 'property Surround2:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:261:1: 'property ModFT2:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:266:1: 'property ModPT1:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:271:1: 'property StopSeeking:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:276:1: 'property StopAllSeeking:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:281:1: 'property StopBackward:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:286:1: 'property Device:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:289:1: 'property Level:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:297:1: 'property Status:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:300:1: 'property Mode3D:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:310:1: 'property MinimumDistance:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:320:1: 'property MaximumDistance:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:330:1: 'property Angle:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:341:1: 'property OuterVolume:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:351:1: 'property Position3D:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:363:1: 'property Orientation3D:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basschannel.pyx:375:1: 'property Velocity3D:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basschannelattribute.pyx:72:1: 'property Sliding:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:202:1: 'property Name:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:207:1: 'property Driver:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:212:1: 'property Status:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:217:1: 'property Flags:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:222:1: 'property Memory:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:227:1: 'property MemoryFree:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:232:1: 'property FreeSamples:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:237:1: 'property Free3D:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:242:1: 'property MinimumRate:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:247:1: 'property MaximumRate:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:252:1: 'property EAX:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:257:1: 'property DirectX:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:262:1: 'property Buffer:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:267:1: 'property Latency:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:272:1: 'property InitFlags:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:277:1: 'property Speakers:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:282:1: 'property Frequency:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:287:1: 'property Volume:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:299:1: 'property Position3D:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:314:1: 'property Velocity3D:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:329:1: 'property Front3D:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:345:1: 'property Top3D:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:361:1: 'property Distance:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:374:1: 'property Rolloff:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:387:1: 'property Doppler:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:401:2: 'property EAXEnvironment:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:413:2: 'property EAXVolume:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:425:2: 'property EAXDecay:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassdevice.pyx:437:2: 'property EAXDamping:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassdsp.pyx:26:1: 'property Channel:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:37:1: 'property Channel:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:41:1: 'property WetDryMix:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:53:1: 'property Depth:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:65:1: 'property Feedback:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:77:1: 'property Frequency:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:89:1: 'property Waveform:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:101:1: 'property Delay:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:113:1: 'property Phase:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:126:1: 'property Gain:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:138:1: 'property Attack:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:150:1: 'property Release:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:162:1: 'property Threshold:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:174:1: 'property Ratio:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:186:1: 'property Predelay:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:199:1: 'property Gain:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:211:1: 'property Edge:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:223:1: 'property PostEQCenterFrequency:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:235:1: 'property PostEQBandwidth:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:247:1: 'property PreLowcutCutoff:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:260:1: 'property WetDryMix:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:272:1: 'property Feedback:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:284:1: 'property LeftDelay:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:296:1: 'property RightDelay:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:308:1: 'property PanDelay:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:321:1: 'property WetDryMix:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:333:1: 'property Depth:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:345:1: 'property Feedback:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:357:1: 'property Frequency:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:369:1: 'property Waveform:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:381:1: 'property Delay:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:393:1: 'property Phase:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:406:1: 'property RateHz:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:418:1: 'property WaveShape:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:431:1: 'property Room:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:443:1: 'property RoomHF:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:455:1: 'property RoomRolloffFactor:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:467:1: 'property DecayTime:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:479:1: 'property DecayHFRatio:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:491:1: 'property Reflections:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:503:1: 'property ReflectionsDelay:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:515:1: 'property Reverb:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:527:1: 'property ReverbDelay:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:539:1: 'property Diffusion:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:551:1: 'property Density:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:563:1: 'property HFReference:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:576:1: 'property Center:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:588:1: 'property Bandwidth:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:600:1: 'property Gain:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:613:1: 'property InGain:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:625:1: 'property ReverbMix:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:637:1: 'property ReverbTime:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassfx.pyx:649:1: 'property HighFreqRTRatio:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\bassplugin.pyx:13:1: 'property Version:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassplugin.pyx:18:1: 'property Formats:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassposition.pyx:62:1: 'property Bytes:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassposition.pyx:75:1: 'property Seconds:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassposition.pyx:88:1: 'property Decode:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassposition.pyx:101:1: 'property Ogg:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:24:1: 'property ChannelCount:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:29:1: 'property Frequency:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:39:1: 'property Volume:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:49:1: 'property Pan:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:59:1: 'property Flags:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:69:1: 'property Length:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:79:1: 'property Max:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:89:1: 'property Resolution:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:99:1: 'property InitChannelCount:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:109:1: 'property MinimumGap:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:119:1: 'property Mode3D:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:129:1: 'property MinimumDistance:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:139:1: 'property MaximumDistance:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:149:1: 'property InnerAngle:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:159:1: 'property OuterAngle:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:169:1: 'property OuterVolume:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:179:1: 'property VAM:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:189:1: 'property Priority:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:199:1: 'property Channels:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssample.pyx:216:1: 'property Data:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basssync.pyx:21:1: 'property Channel:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:244:1: 'property HTTP:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:249:1: 'property APEv1:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:254:1: 'property APEv2:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:271:1: 'property CoreAudio:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:279:1: 'property Shoutcast:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:284:1: 'property ID3v1:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:302:1: 'property ID3v2:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:320:1: 'property Lyrics3:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:325:1: 'property Meta:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:330:1: 'property MediaFoundation:'
syntax is deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:335:1: 'property MP4:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:340:1: 'property MODInstruments:' syntax
is deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:354:1: 'property MODMessage:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:359:1: 'property MODName:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:364:1: Removing old files
Compiling Bass4Py\bass.pyx because it changed.
Compiling Bass4Py\basschannel.pyx because it changed.
Compiling Bass4Py\basschannelattribute.pyx because it changed.
Compiling Bass4Py\bassdevice.pyx because it changed.
Compiling Bass4Py\bassdsp.pyx because it changed.
Compiling Bass4Py\bassfx.pyx because it changed.
Compiling Bass4Py\bassmusic.pyx because it changed.
Compiling Bass4Py\bassplugin.pyx because it changed.
Compiling Bass4Py\bassposition.pyx because it changed.
Compiling Bass4Py\basssample.pyx because it changed.
Compiling Bass4Py\bassstream.pyx because it changed.
Compiling Bass4Py\basssync.pyx because it changed.
Compiling Bass4Py\basstags.pyx because it changed.
Compiling Bass4Py\bassvector.pyx because it changed.
Compiling Bass4Py\bassversion.pyx because it changed.
[ 1/15] Cythonizing Bass4Py\bass.pyx
[ 2/15] Cythonizing Bass4Py\basschannel.pyx
[ 3/15] Cythonizing Bass4Py\basschannelattribute.pyx
[ 4/15] Cythonizing Bass4Py\bassdevice.pyx
[ 5/15] Cythonizing Bass4Py\bassdsp.pyx
[ 6/15] Cythonizing Bass4Py\bassfx.pyx
[ 7/15] Cythonizing Bass4Py\bassmusic.pyx
[ 8/15] Cythonizing Bass4Py\bassplugin.pyx
[ 9/15] Cythonizing Bass4Py\bassposition.pyx
[10/15] Cythonizing Bass4Py\basssample.pyx
[11/15] Cythonizing Bass4Py\bassstream.pyx
[12/15] Cythonizing Bass4Py\basssync.pyx
[13/15] Cythonizing Bass4Py\basstags.pyx
[14/15] Cythonizing Bass4Py\bassvector.pyx
[15/15] Cythonizing Bass4Py\bassversion.pyx
running build_ext
building 'Bass4Py.bass' extension
C:\Users\***\WinPython-32bit-2.7.10.2\python-2.7.10\Scripts\gcc.exe
-mdll -O -Wall -ID:\Privat\Skripte\Bass4Py
-IC:\Users\***\WinPython-32bit-2.7.10.2\python-2.7.10\include
-IC:\Users\***\WinPython-32bit-2.7.10.2\python-2.7.10\PC -c
Bass4Py\bass.c -o build\temp.win32-2.7\Release\bass4py\bass.o
Bass4Py\bass.c: In function '__Pyx_RaiseArgtupleInvalid':
Bass4Py\bass.c:12495:18: warning: unknown conversion type character
'z' in format [-Wformat=]
                  (num_expected == 1) ? "" : "s", num_found);
                  ^
Bass4Py\bass.c:12495:18: warning: format '%s' expects argument of type
'char *', but argument 5 has type 'Py_ssize_t' [-Wformat=]
Bass4Py\bass.c:12495:18: warning: unknown conversion type character
'z' in format [-Wformat=]
Bass4Py\bass.c:12495:18: warning: too many arguments for format
[-Wformat-extra-args]
Bass4Py\bass.c: In function '__Pyx_ImportType':
Bass4Py\bass.c:13794:13: warning: unknown conversion type character
'z' in format [-Wformat=]
             module_name, class_name, basicsize, size);
             ^
Bass4Py\bass.c:13794:13: warning: unknown conversion type character
'z' in format [-Wformat=]
Bass4Py\bass.c:13794:13: warning: too many arguments for format
[-Wformat-extra-args]
Bass4Py\bass.c:13800:13: warning: unknown conversion type character
'z' in format [-Wformat=]
             module_name, class_name, basicsize, size);
             ^
Bass4Py\bass.c:13800:13: warning: unknown conversion type character
'z' in format [-Wformat=]
Bass4Py\bass.c:13800:13: warning: too many arguments for format
[-Wformat-extra-args]
writing build\temp.win32-2.7\Release\bass4py\bass.def
C:\Users\***\WinPython-32bit-2.7.10.2\python-2.7.10\Scripts\gcc.exe
-shared -s build\temp.win32-2.7\Release\bass4py\bass.o
build\temp.win32-2.7\Release\bass4py\bass.def
-LD:\Privat\Skripte\Bass4Py
-LC:\Users\***\WinPython-32bit-2.7.10.2\python-2.7.10\libs
-LC:\Users\***\WinPython-32bit-2.7.10.2\python-2.7.10\PCbuild -lbass
-lpython27 -lmsvcr90 -o D:\Privat\Skripte\Bass4Py\Bass4Py\bass.pyd
building 'Bass4Py.basschannel' extension
C:\Users\***\WinPython-32bit-2.7.10.2\python-2.7.10\Scripts\gcc.exe
-mdll -O -Wall -ID:\Privat\Skripte\Bass4Py
-IC:\Users\***\WinPython-32bit-2.7.10.2\python-2.7.10\include
-IC:\Users\***\WinPython-32bit-2.7.10.2\python-2.7.10\PC -c
Bass4Py\basschannel.c -o
build\temp.win32-2.7\Release\bass4py\basschannel.o
Bass4Py\basschannel.c:1616:43: error: expected '(' before ';' token
   __pyx_t_7Bass4Py_4bass_DWORD __attribute;
                                           ^
Bass4Py\basschannel.c: In function '__Pyx_RaiseArgtupleInvalid':
Bass4Py\basschannel.c:13691:18: warning: unknown conversion type
character 'z' in format [-Wformat=]
                  (num_expected == 1) ? "" : "s", num_found);
                  ^
Bass4Py\basschannel.c:13691:18: warning: format '%s' expects argument
of type 'char *', but argument 5 has type 'Py_ssize_t' [-Wformat=]
Bass4Py\basschannel.c:13691:18: warning: unknown conversion type
character 'z' in format [-Wformat=]
Bass4Py\basschannel.c:13691:18: warning: too many arguments for format
[-Wformat-extra-args]
Bass4Py\basschannel.c: In function '__Pyx_ImportType':
Bass4Py\basschannel.c:15336:13: warning: unknown conversion type
character 'z' in format [-Wformat=]
             module_name, class_name, basicsize, size);
             ^
Bass4Py\basschannel.c:15336:13: warning: unknown conversion type
character 'z' in format [-Wformat=]
Bass4Py\basschannel.c:15336:13: warning: too many arguments for format
[-Wformat-extra-args]
Bass4Py\basschannel.c:15342:13: warning: unknown conversion type
character 'z' in format [-Wformat=]
             module_name, class_name, basicsize, size);
             ^
Bass4Py\basschannel.c:15342:13: warning: unknown conversion type
character 'z' in format [-Wformat=]
Bass4Py\basschannel.c:15342:13: warning: too many arguments for format
[-Wformat-extra-args]
'property MODSamples:' syntax is deprecated, use ' <at> property'
warning: Bass4Py\basstags.pyx:378:1: 'property OGG:' syntax is
deprecated, use ' <at> property'
warning: Bass4Py\bassversion.pyx:5:1: 'property String:' syntax is
deprecated, use ' <at> property'
error: command 'C:\\Users\\***\\WinPython-32bit-2.7.10.2\\python-2.7.10\\Scripts\\gcc.exe'
failed with exit status 1

The warnings appearing in the build process also showed up while
compiling the latest cython master.

The errorneous line, including some referencing code, lookks like follows:

basschannelattribute.pxd

cdef class BASSCHANNELATTRIBUTE:
 cdef readonly HCHANNEL __channel
 cdef readonly DWORD __attribute
 cpdef __getmusicvolchan(BASSCHANNELATTRIBUTE self)
 cpdef __getnobuffer(BASSCHANNELATTRIBUTE self)
 cpdef __setmusicvolchan(BASSCHANNELATTRIBUTE self,list value)
...

The DWORD type is defined in bass.pxd and looks like follows.
ctypedef unsigned long DWORD

The HCHANNEL type is also just defined as DWORD at this time.

Calling gcc --version shows the following:
gcc.exe (i686-win32-sjlj-rev201506, mingwpy build) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Is this any bug of python, cython or whatever, or am I wrong with my
code? Any advice would be appreciated.

Best Regards.

Toni

--

-- 

--- 
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Bradshaw | 11 Mar 09:23 2016
Picon

Cython alpha 0.24

We are getting ready to push a new major release. A first alpha is up
at http://cython.org/release/Cython-0.24a0.tar.gz

To avoid surprises, please test and report.

Thanks,
Robert

--

-- 

--- 
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yang Wang | 10 Mar 02:39 2016
Picon

Wrap C static library

Is it possible to wrap a static C library that was compiled withOUT -fPIC flag?

For an example, jsmn (https://github.com/zserge/jsmn) is a minimal JSON parser in C. When compile, the make command creates a static library called "libjsmn.a" (without -fPIC flag).

I tried to wrap this little library with following cython file called "cjsmn.pyx"

cdef extern from 'jsmn.h':
    ctypedef struct jsmn_parser:
        pass

    void jsmn_init(jsmn_parser *parser)

def init():
    cdef jsmn_parser parser
    jsmn_init(&parser)



and the simple "setup.py" file is as the follows:

from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize

ext = Extension('cjsmn',
        sources=['cjsmn.pyx'],
        include_dirs=['../jsmn'],
        library_dirs=['../jsmn'],
        libraries=['jsmn'],
        )


setup(ext_modules=cythonize(ext))


But it does NOT compile (python setup.py build_ext -i) and the error message is:

/usr/bin/ld: ../jsmn/libjsmn.a(jsmn.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../jsmn/libjsmn.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1


If I re-compile the static library with "-fPIC" as suggested by the error message, everything works. But is it possible to fix this problem withOUT recompile the static library?? Because I need to wrap some other static C libraries that I do NOT have the source to recompile ..

Any help is appreciated!!

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
winebra | 1 Mar 21:55 2016
Picon

shift count negative or too big, undefined behavior warning

Hi all,
I'm using Python 3.5.1 |Anaconda 2.5.0 (64-bit)| on Windows 64 bit. VC vuild tools 14.
Some times I get the following error after cythonizing:
warning C4293: '<<': shift count negative or too big, undefined behavior
The warning occurs at (1L<<53). Clearly the problem is that it tries to shift 53 times 32 bit integer.
When looking at the code it looks as follows:

        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }

Have anyone encountered with the problem? Is there a way to solve it?

Thanks,
Vadim.

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Pallav Gupta | 9 Mar 11:01 2016
Picon

How to implement operator==() and operator!=() in Cython

Hi,

I have a C++ header file that implements the == operator for a class I want to expose to Python via Cython. I'm attempting to learn Cython. I read the tutorials but am not totally sure how to implement the == / != operator. What I tried is the following:

cdef extern from "CBoundingBox.h":
    cdef cppclass CBoundingBox:
        CBoundingBox()
        CBoundingBox(int, int, int, int) except +
        
        <snip>
        
        int operator==(CBoundingBox&)
        int operator!=(CBoundingBox&)

cdef class PyCBoundingBox:
    cdef CBoundingBox* thisptr
    def __cinit__(self, xmin=None, xmax=None, ymin=None, ymax=None):
        if all(v is None for v in [xmin, xmax, ymin, ymax]):
            self.thisptr = new CBoundingBox()
        else:
            self.thisptr = new CBoundingBox(xmin, xmax, ymin, ymax)
    def __dealloc__(self):
        del self.thisptr

    <snip>
    
    def __richcmp__(self, rhs, op):
        if op == 2: # ==
            return self.thisptr == rhs.thisptr
        if op == 3: # !=
            return self.thisptr != rhs.thisptr

The code compiles OK, and I am able to build a shared library. However, I get the following error. What am I doing wrong and how to fix this? Thanks.

>>> import dogs
>>> a=dogs.PyCBoundingBox(0,0,1,1)
>>> b=dogs.PyCBoundingBox(0,0,1,1)
>>> a==b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "dogs.pyx", line 35, in dogs.PyCBoundingBox.__richcmp__ (dogs.cpp:1517)
    return self.thisptr == rhs.thisptr
AttributeError: 'dogs.PyCBoundingBox' object has no attribute 'thisptr'



--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Antony Lee | 8 Mar 20:38 2016
Picon

Inconsistent casting safety checks

Consider:

def main():
    cdef:
        unsigned u = 0
        int i = 0
        float f = 0
    u = i
    i = f

Both assignments (unsigned <- int and int <- float) are C-legal but "unsafe", but Cython compiles the first one without even a warning, whereas the second one is reported as a fatal error.  I guess my (weak) preference would be a warning in both cases, but at least it should be consistent.

Antony

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Antony Lee | 8 Mar 03:20 2016
Picon

Provide standard numpy fused types in numpy/__init__.pxd

Numpy provides a few standard "abstract" types, which can be thought of as fused types: generic, number, integer, signedinteger, unsignedinteger, inexact, floating, complexfloating, flexible and character (see diagram in http://docs.scipy.org/doc/numpy/reference/arrays.scalars.html#scalars).

It would be nice if these were available as fused types in numpy/__init__.pxd (note that they are different from the standard integral, floating and numeric fused types as they include data types with fixed size).

Antony

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nikolaus Rath | 8 Mar 00:47 2016

Confused about datatype conversions in expression evaluation

Hello,

I have a hard time memorizing which datatypes are used to evaluate
different parts of an expression. For example:

def foo(p_val):
   cdef int c_val
   return c_val * 1e9

As far as I can tell, "c_val * 1e9" is evaluated as integer (so it will
likely overflow on 32 bit systems) and then converted to a Python
integer. Instead, I would have expected that this is evaluated either as
a C double (treating 1e9 as a C literal), or as a Python float (treating
1e9 as a Python literal). 

On the other hand:

def foo(p_val):
   cdef int c_val
   return c_val / 1e9

is evaluated with Python semantics (i.e., true division), and the result
will be a Python float. 

What is the best way to figure out how these expressions are evaluated?
For example, the only way for me to figure out the following is to look
at the generated C code:

def foo_1(p_val):
   cdef int c_val
   return c_val * p_val 

def foo_2(p_val):
   cdef int c_val_1
   cdef int c_val_2
   return c_val_1 / c_val_2

Is there some rule that tells me what will happpen in these cases? I can
come up with justifications for pretty much every possible outcome..

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«

--

-- 

--- 
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hai Nguyen | 4 Mar 21:15 2016
Picon

osx: Reason: image not found

hi all,

I am working on a Python wrapping to a C++ library. This program works fine with Linux (been testing on travis for a year).

Recently, travis has OSX so I gave a shot. However, my python package can not find the C++ lib although I did set LD_LIBRARY_PATH (tried with DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH too).

This is a part of error:

$ python -c 'import pytraj as pt'

Traceback (most recent call last):

File "<string>", line 1, in <module>

File "/Users/travis/miniconda/envs/myenv/lib/python2.7/site-packages/pytraj/__init__.py", line 12, in <module>

from .cpp_options import info as compiled_info

ImportError: dlopen(/Users/travis/miniconda/envs/myenv/lib/python2.7/site-packages/pytraj/cpp_options.so, 2): Library not loaded: libcpptraj.dylib

Referenced from: /Users/travis/miniconda/envs/myenv/lib/python2.7/site-packages/pytraj/cpp_options.so

Reason: image not found

$ ls $CPPTRAJHOME/lib/

libcpptraj.dylib



My labmate pointed out that this might happens on El Capitan: Apple effectively eliminated DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH for all system utilities ( (wiping them out before executing the programs).

I am wondering if anyone has solution for this. Does setting rpath help? If yes, how can I do  that?

Please let me know if I need to give further info.

Thanks.

Hai

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe <at> googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gmane