Comments (3)
The underlying problem is that the default for restype is c_int
and pointers have a c_long
similar length, on 64 bit Linux.
A quick fix is to set the restype to c_long
and leave everything else or use prototypes in general.
When we use prototypes, we might set them all in one place, which separates them from the corresponding python function.s
Creating a MyCDLL
with _func_restype_ = c_long
might be another possibility.
Altogether this could mean a bigger change in design so I just commited this as-is now.
from python-discid.
I added a test for this in 934d05d9d34a0109031a99f0f9699074c34f7efa (branch restype_long)
./discid.py
in that test version gives on 64 bit Linux, Python 3.2.3 (same on Python 2.7.3, but with ()
):
<class 'int'>
default: 610197754
<class 'int'>
c_int: 610197754
<class 'int'>
c_long: 140175457837306
<class 'int'>
c_void_p: 140175457837306
c_char_p(140175457837306)
/dev/cdrom
On 32 bit Windows XP (in a virtual machine, Python 2.7.3):
<type 'int'>
default: 1765843380
<type 'int'>
c_int: 1765843380
<type 'int'>
c_long: 1765843380
<type 'int'>
c_void_p: 1765843380
()
c_char_p('cdaudio')
cdaudio
On Cygwin (on the same Windows in the same virtual machine, Python 2.6.8):
<type 'int'>
default: 1693471444
<type 'int'>
c_int: 1693471444
<type 'int'>
c_long: 1693471444
<type 'int'>
c_void_p: 1693471444
()
c_char_p(1693471444)
cdaudio
from python-discid.
On python there is no distinction made. See also PEP-0237.
from python-discid.
Related Issues (20)
- Find libdiscid in current folder for linux/unix HOT 2
- Prefer libdiscid in current directory HOT 1
- Darwin default_device breaks module tests HOT 4
- disc access test suite
- consider using `discid_read_sparse` when/if implemented in libdiscid HOT 2
- Uninformative error on Windows when libdiscid is not found HOT 1
- reconsider track_offsets[0], track_lengths[0] etc. HOT 2
- Don't expose discid_get_webservice_url HOT 2
- Don't make DEFAULT_DEVICE a constant HOT 2
- add get_devices() function? HOT 3
- leaks many file descriptors HOT 1
- Ask user to re-enter user/password on authentication errors HOT 1
- py2app dmg/dylib problems again HOT 4
- On Windows system wide discid.dll seems to be preferred over local version HOT 5
- Doc fails to build with sphinx 1.3 HOT 1
- Split up DiscError HOT 1
- macOS: Prefer libdiscid.dylib in current folder HOT 2
- Add gpg key HOT 1
- tests relying on /dev/cdrom failing when running with pytest
- Invalid TOC seemingly generated (MBS-10050)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-discid.