[ python-Bugs-1281408 ] Py_BuildValue k format units don't work with big values
Bugs item #1281408, was opened at 2005-09-04 00:12 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1281408&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.4 >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Adal Chiriliuc (adalx) Assigned to: Reinhold Birkenfeld (birkenfeld) Summary: Py_BuildValue k format units don't work with big values Initial Comment: Python 2.4 on Windows XP SP2 Consider this code: unsigned long x = 0xaabbccdd; PyObject* v = Py_BuildValue("k", x); unsigned long y = PyLong_AsUnsignedLong(v); y will be equal with -1 because PyLong_AsUnsignedLong will raise an OverflowError since Py_BuildValue doesn't create a long for the "k" format unit, but an int which will be interpreted as a negative number. The K format seems to have the same error, PyLong_FromLongLong is used instead of PyLong_FromUnsignedLongLong. The do_mkvalue function from mod_support.c must be fixed to use PyLong_FromUnsignedLong instead of PyInt_FromLong for "k". Also, the BHLkK format units for Py_BuildValue should be documented. In my Python 2.4 manual they do not appear. -- >Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-11-24 16:39 Message: Logged In: YES user_id=1188172 Corrected patch committed in rev. 41527 and 41528 (2.4). -- Comment By: Martin v. Löwis (loewis) Date: 2005-11-13 11:31 Message: Logged In: YES user_id=21627 The patch looks wrong: for 'I' (capital i), you va_arg unsigned long; I think 'I' should do unsigned int instead. A minor nit: why does it move the 'l' case (lower L)? Apart from that, the patch looks fine. -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-11-11 09:45 Message: Logged In: YES user_id=1188172 Ping! -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-09-18 12:07 Message: Logged In: YES user_id=1188172 Attaching patch (including doc changes). For I and k, it creates an int if it fits, else a long. -- Comment By: Martin v. Löwis (loewis) Date: 2005-09-18 10:59 Message: Logged In: YES user_id=21627 I'm not sure what it should do: the other option would be to create an int if it fits, else a long. For 2.4.x atleast, this would give better backwards compatibility given the status quo. I certainly agree that the documentation should be updated. Patches are welcome. -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-09-14 22:02 Message: Logged In: YES user_id=1188172 I think you're right. Do you too, Martin? -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1281408&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1365984 ] urllib cannot open data: urls
Bugs item #1365984, was opened at 2005-11-25 12:20 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1365984&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Warren Butler (grumpymole) Assigned to: Nobody/Anonymous (nobody) Summary: urllib cannot open data: urls Initial Comment: Python 2.4.2 cannot open data: urls using open_data(). Appears to be because of importing cStringIO and not being able to reference fileno. == Example fail output: Traceback (most recent call last): File "test_open_data.py", line 6, in ? response = opener.open("data:,A%20brief%20note") File "/usr/lib/python2.4/urllib.py", line 185, in open return getattr(self, name)(url) File "/usr/lib/python2.4/urllib.py", line 559, in open_data f.fileno = None # needed for addinfourl AttributeError: 'cStringIO.StringI' object has no attribute 'fileno' == Example code to generate failure: import urllib # data:,A%20brief%20note opener = urllib.URLopener() response = opener.open("data:,A%20brief%20note") == Note: works in 2.2 version of library. Problem appears to be here in 2.4: import mimetools try: from cStringIO import StringIO except ImportError: from StringIO import StringIO whereas 2.2 reads: import StringIO, mimetools, time -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1365984&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1366000 ] Bug bz2.BZ2File(...).seek(0,2)
Bugs item #1366000, was opened at 2005-11-25 03:14 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1366000&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: STINNER Victor (haypo) Assigned to: Nobody/Anonymous (nobody) Summary: Bug bz2.BZ2File(...).seek(0,2) Initial Comment: Hi, Look at the following code: import bz2 bz2.BZ2File("test.bz2","r") bz2.seek(0,2) assert bz2.tell() != 0 seek() method is buggy (when 0<=offset and where=2). I wrote a patch. Haypo -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1366000&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1366000 ] Bug bz2.BZ2File(...).seek(0,2)
Bugs item #1366000, was opened at 2005-11-25 03:14 Message generated for change (Comment added) made by haypo You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1366000&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: STINNER Victor (haypo) Assigned to: Nobody/Anonymous (nobody) Summary: Bug bz2.BZ2File(...).seek(0,2) Initial Comment: Hi, Look at the following code: import bz2 bz2.BZ2File("test.bz2","r") bz2.seek(0,2) assert bz2.tell() != 0 seek() method is buggy (when 0<=offset and where=2). I wrote a patch. Haypo -- >Comment By: STINNER Victor (haypo) Date: 2005-11-25 03:21 Message: Logged In: YES user_id=365388 Please check it :-) I'm not sure that it works well because I'm new in CPython code. Oops ... I just tried my code, and seek(x,2) with 0https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1366000&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com