rajeshveerepalli / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Undefined symbols in Python3.2 #201

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Download the package or clone the git repository.
2. Build using python 2.7 (setyp.py doesn't seem to work in python 3.x, syntax 
error)
3. Try to "import pyodbc" using python3.2

What is the expected output? 

Nothing.

What do you see instead?

Undefined symbols. 
First it's PyExc_StandardError. I change that to PyExc_Exception, which I 
believe is the correct one(http://python.org/dev/peps/pep-0352). Not sure thats 
all that is needed though, to say the least.

Anyway, after fixing that, another pops up: _Py_ZeroStruct. 
However I cannot find that one in any part of the code.

Python 3.2 (r32:88445, Mar 25 2011, 19:56:22) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyodbc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: ./pyodbc.so: undefined symbol: _Py_ZeroStruct

What version of the product are you using? On what operating system?
2.1.9 or git.
Ubuntu.

Please provide any additional information below.
I hope that someone finds this blindingly obvious.

Original issue reported on code.google.com by nickl...@gmail.com on 21 Aug 2011 at 8:06

GoogleCodeExporter commented 8 years ago
Are you building with the "py3" branch?

That branch will become pyodbc 3.x and supports building Python 2.x and 3.x 
with the same codebase.

Original comment by mkleehammer on 21 Aug 2011 at 8:50

GoogleCodeExporter commented 8 years ago
No I didn't, since I was under the impression that 2.1.9 would have Python3.x 
support.

Anyway, I tried using the py3 branch that an it didn't compile, I got: 
pyodbc/src/row.cpp:386:1: error: invalid conversion from ‘PyObject* 
(*)(PyObject*, Py_ssize_t, Py_ssize_t)’ to ‘void*’

Original comment by nickl...@gmail.com on 21 Aug 2011 at 8:59

GoogleCodeExporter commented 8 years ago
Oh, and yes, the py3 setup.py worked in python3.2, with the exception of the 
gcc error of course.

Original comment by nickl...@gmail.com on 21 Aug 2011 at 9:01

GoogleCodeExporter commented 8 years ago
I just realised my first reply could be considered somewhat snarky. 
That wasn't the intention.

Original comment by nickl...@gmail.com on 22 Aug 2011 at 4:34

GoogleCodeExporter commented 8 years ago
Hm, I am getting the _Py_ZeroStruct error when trying to run psycopg2 v 2.4.2 
as well. That one is also supposed to work on Python 3. I am running on python 
3.2 right now.
Things are getting really strange around here.

Original comment by nickl...@gmail.com on 31 Aug 2011 at 5:06

GoogleCodeExporter commented 8 years ago
Same situation with Python 3.2 + Ubuntu 11.04 x64.

Original comment by andres.o...@gmail.com on 1 Sep 2011 at 9:43

GoogleCodeExporter commented 8 years ago
I'm getting, 

error: invalid conversion from ‘PyObject* (*)(PyObject*, Py_ssize_t, 
Py_ssize_t)’ to ‘void*’

python 3.2.2 built with --enable-shared  Ubuntu 11.04 x64

Original comment by neilbed...@gmail.com on 30 Sep 2011 at 3:46

GoogleCodeExporter commented 8 years ago
Ok, so this is now  a duplicate of #132.

Original comment by nickl...@gmail.com on 29 Oct 2011 at 6:17

GoogleCodeExporter commented 8 years ago
Hi, 
I made the attached changes, at least it gets the code built.
I have not yet throughly tested the code(almost not at all), but it should be a 
step in the right direction, haven't done any C in about 20 years so please be 
gentle.

Original comment by nickl...@gmail.com on 29 Oct 2011 at 7:49

Attachments:

GoogleCodeExporter commented 8 years ago
Ok, I have now tested a little and I have made creates, drops, updates, inserts 
and selects and is seems to work as it is supposed to. 
So, applying the GIT-diff-patch in my above commend is a way around that.

Original comment by nickl...@gmail.com on 30 Oct 2011 at 1:48

GoogleCodeExporter commented 8 years ago
Fixed in 3.0.1

Original comment by mkleehammer on 3 Nov 2011 at 2:01

GoogleCodeExporter commented 8 years ago
Yay!

Original comment by nickl...@gmail.com on 3 Nov 2011 at 8:14