[issue35523] Remove old ctypes callback workaround: creating the first instance of a callback
Campbell Barton added the comment: Note, this bug is something we ran into in Blender, see: https://developer.blender.org/T84752 -- ___ Python tracker <https://bugs.python.org/issue35523> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35523] Remove old ctypes callback workaround: creating the first instance of a callback
Campbell Barton added the comment: Could this fix be applied to Python 3.7x? Currently the visual effects platform for 2021 is using Python 3.7.x, see: https://vfxplatform.com Which means anyone using the VFX platform can run into this bug. -- nosy: +ideasman42 ___ Python tracker <https://bugs.python.org/issue35523> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9499] DOC: C/API Execution namespace undocumented. (patch included)
Campbell Barton added the comment: This patch is still relevant, mentioning this since the patch is from a while ago. -- ___ Python tracker <https://bugs.python.org/issue9499> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41802] Missing documentation for 'PyDict_DelItem' behavior
Campbell Barton added the comment: Edit: When calling 'PyDict_DelItem' on a key that isn't in the dictionary, a 'KeyError' is raised. This is not documented. >From reading the current documentation, it only seems as if an error is raised >if the key can't be hashed. -- ___ Python tracker <https://bugs.python.org/issue41802> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41802] Missing documentation for 'PyDict_DelItem' behavior
New submission from Campbell Barton : When calling 'PyDict_DelItem' on a key that isn't in the hash a KeyError is raised. This is not documented. -- components: C API messages: 377053 nosy: ideasman42 priority: normal severity: normal status: open title: Missing documentation for 'PyDict_DelItem' behavior versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue41802> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32354] Unclear intention of deprecating Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER
Campbell Barton added the comment: Thanks for the info, in that case will there be a way to do this from the CPython API which can work with raw strings? (utf8, wchat_t or similar types), that doesn't require the GIL and alloc/free of PyObjects. -- ___ Python tracker <https://bugs.python.org/issue32354> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32354] Unclear intention of deprecating Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER
New submission from Campbell Barton : Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER are marked as deprecated in the docs. https://docs.python.org/3/c-api/unicode.html?highlight=py_unicode_tolower#c.Py_UNICODE_TOLOWER Someone submitted a patch to our project which uses these. What is unclear, is if there is an intention to replace these (wrappers for '_PyUnicode_ToLowerFull' for eg). Or if this will be removed without any alternative. I assume the functionality will be kept somewhere since Python needs str.lower/upper. Will there be a way to perform this in the future? Either way, could docs be updated to reflect this? -- components: Unicode messages: 308506 nosy: ezio.melotti, ideasman42, vstinner priority: normal severity: normal status: open title: Unclear intention of deprecating Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue32354> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27096] Ability to get random bytes from random.Random (as with os.urandom)
Campbell Barton added the comment: @serhiy.storchaka, while a properly working function that uses getrandbits isn't so complex, its not trivial either. It needs to create smaller chunks and join them (also check zero size case which raises an error if passed). eg: ``` def urandom_from_random(rng, length): if length == 0: return b'' import sys chunk_size = 65535 chunks = [] while length >= chunk_size: chunks.append(rng.getrandbits(chunk_size * 8).to_bytes(chunk_size, sys.byteorder)) length -= chunk_size if length: chunks.append(rng.getrandbits(length * 8).to_bytes(length, sys.byteorder)) result = b''.join(chunks) return result ``` -- ___ Python tracker <http://bugs.python.org/issue27096> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27096] Ability to get random bytes from random.Random (as with os.urandom)
Campbell Barton added the comment: @r.david.murray, yes, this avoids list creation, but is still quite slow. To create 1mb of data, you can compare the following: python -m timeit -s 'from os import urandom' 'print(len(urandom(100)))' python -m timeit -s 'from random import randint' 'print(len(bytes(randint(0, 255) for i in range(100' On my system `os.urandom` is 0.04sec, using randint takes 2.24sec (approx 50x slower). -- ___ Python tracker <http://bugs.python.org/issue27096> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27096] Ability to get random bits from random.Random (as with os.urandom)
Campbell Barton added the comment: Correction, meant to write: random.randbytes(n). -- ___ Python tracker <http://bugs.python.org/issue27096> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27096] Ability to get random bits from random.Random (as with os.urandom)
New submission from Campbell Barton: Currently, getting random bits can be done with os.urandom, However recently I was faced with having to make a test (with reproducible behavior), so I needed to replace os.urandom with a random generator that took a seed value. It turns out there are 3 ways (at least) to handle this, but none are really that great. - Create a list, fill with Random.randint(0, 255), then convert to bytes with bytes.join. - Call Random.getrandbits(), then int.to_bytes. - Override urandom at a system level (possible on Linux [0]). While these work, they are either slow (creating a list), non trivial (OS-level) or limited - Random.getrandbits hits internal limits of an int, and accidentally using the int (running repr on it for example, locks up Python), currently CPython will fail to create values above 256mb since bits is limited to INT_MAX [1]. In short, to keep tests running fast, and without messing about and accounting for internal limits of CPython, there isn't a convenient way to get random bits in Python. Since bits are a primitive type and since its already supported by os.urandom, I think its reasonable the random module could support returning random bits. If this is accepted, I can provide a patch for this, I'm just checking to know if the functionality would be accepted. Suggest to call random.randbits(n). [0]: http://stackoverflow.com/questions/26053875/bypass-dev-urandomrandom-for-testing [1]: http://bugs.python.org/issue27072 -- components: Library (Lib) messages: 266202 nosy: ideasman42 priority: normal severity: normal status: open title: Ability to get random bits from random.Random (as with os.urandom) type: enhancement versions: Python 3.6 ___ Python tracker <http://bugs.python.org/issue27096> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows
Campbell Barton added the comment: @rhettinger, agree that very large ints in this case aren't going to give very usable results. On the other hand, this limit isn't imposed elsewhere (you can power-of operator to create bigger numbers). Nevertheless this isn't going to give good/usable performance. Might having a method added to `randome.Random` that returns random bits (as os.urandom does), be something Python project would consider accepting? -- ___ Python tracker <http://bugs.python.org/issue27072> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows
Campbell Barton added the comment: > This probably isn't an issue on non-Windows or 64-bit systems. In fact it is, the limitation applies to 64bit Linux too. (tested in CPython 3.5.1) -- nosy: +ideasman42 ___ Python tracker <http://bugs.python.org/issue27072> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows
Campbell Barton added the comment: A related question, (realize this isn't a support forum), but what is the equivalent API calls in Python3.5 so we can update scripts. Should we be doing: os.walk(os.fsdecode(path)) ? >From Python's documentation, os.fsdecode is using 'strict' handler which may >raise exceptions. I'm mainly concerned that changes here will introduce bugs where bytes previously resolved the paths (albeit working in an imperfect way). If this is not the best place to ask about this, then can post elsewhere. -- ___ Python tracker <http://bugs.python.org/issue25911> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows
Campbell Barton added the comment: @haypo, I checked available info online and couldn't find any reference to byte file-paths were deprecated since Python3.2. On the contrary, the 3.2 release notes [0] state: "countless fixes regarding bytes/string issues; among them full support for a bytes environment (filenames, environment variables)" Also docs for open 3.2 [1] and 3.5 [2] say that byte filenames are supported with no mention of deprecation. Since this is already working properly in 3.5 for other systems besides ms-windows, and worked in 3.4x. Dropping support on a single platform seems a rather problematic regression. [0]: https://www.python.org/download/releases/3.2/ [1]: https://docs.python.org/3.2/library/functions.html#open [2]: https://docs.python.org/3.5/library/functions.html#open -- nosy: +ideasman42 ___ Python tracker <http://bugs.python.org/issue25911> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.
Campbell Barton added the comment: Updated the patch for '93049:d9a3d23cf8f0' Note, the link for the original bug report has changed: See https://developer.blender.org/T31856 -- status: closed -> open Added file: http://bugs.python.org/file36913/fix_unicode_v2.diff ___ Python tracker <http://bugs.python.org/issue15859> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.
Changes by Campbell Barton : -- resolution: out of date -> remind ___ Python tracker <http://bugs.python.org/issue15859> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16123] IDLE - deprecate running without a subprocess
Campbell Barton added the comment: @Roger, I should have mentioned I had to add "-n" to the argv so subprocess would be disabled. -- ___ Python tracker <http://bugs.python.org/issue16123> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16123] IDLE - deprecate running without a subprocess
Campbell Barton added the comment: Hi, I just found a use for this feature, with `use_subprocess` being optional its possible to load idle into a running python session. -- import idlelib import idlelib.PyShell idlelib.PyShell.main() -- This allows you to load idle inside an application that embeds python, is there some other way to do this without this option? -- nosy: +ideasman42 ___ Python tracker <http://bugs.python.org/issue16123> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.
Campbell Barton added the comment: patch attached, simply wraps putenv() -- keywords: +patch Added file: http://bugs.python.org/file28144/pyos_putenv.diff ___ Python tracker <http://bugs.python.org/issue16129> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.
Campbell Barton added the comment: Agree PyOS_PutEnv would be good since its not restricted to string encoding and resolves the problem of not being able to control env vars for an embedded interpreter in general. Having ways to change encoding is good too but a bit outside the scope of this report and possibly not the best solution either since its possible (through unlikely), that you need to set the encoding at the very start of python initialization- rather than site & builtin modules loads. -- ___ Python tracker <http://bugs.python.org/issue16129> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.
New submission from Campbell Barton: note, I was asked to report this issue, posted on the py dev mailing list: see - http://code.activestate.com/lists/python-dev/118015/ --- We've run into an issue recently with blender3d on ms-windows where we want to enforce the encoding is UTF-8 with the embedded python interpreter. (the encoding defaults to cp437). I naively thought setting the environment variable before calling Py_Initialize() would work, but the way python DLL loads, it gets its own environment variables that cant be modified directly [1]. eg, _putenv("PYTHONIOENCODING=utf-8:surrogateescape"); We had bug reports by windows users not able to export files because the stdout errors on printing paths with unsupported encoding. [2],[3] --- Of course we could distribute blender with a bat file launcher that sets env variables, or ask the user to set their env variable - but I dont think this is really a good option. I tried overriding the stderr & stdout, but this caused another bug on exiting, giving an assert in MSVCR90.DLL's write.c (called from python32_d.dll): _VALIDATE_CLEAR_OSSERR_RETURN((_osfile(fh) & FOPEN), EBADF, -1); import sys, io sys.__stdout__ = sys.stdout = io.TextIOWrapper(io.open(sys.stdout.fileno(), "wb", -1), encoding='utf-8', errors='surrogateescape', newline="\n", line_buffering=True) sys.__stderr__ = sys.stderr = io.TextIOWrapper(io.open(sys.stderr.fileno(), "wb", -1), encoding='utf-8', errors='surrogateescape', newline="\n", line_buffering=True) IMHO either of these solutions would be fine. * have a PyOS_PutEnv() function, gettext has gettext_putenv() to workaround this problem. * manage this the same as Py_GetPythonHome(), which can be defined by the embedding application to override the default. [1] http://stackoverflow.com/questions/5153547/environment-variables-are-different-for-dll-than-exe [2] http://projects.blender.org/tracker/index.php?func=detail&aid=32750 [3] http://projects.blender.org/tracker/index.php?func=detail&aid=31555 -- components: Windows messages: 171938 nosy: ideasman42 priority: normal severity: normal status: open title: No good way to set 'PYTHONIOENCODING' when embedding python. versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue16129> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.
New submission from Campbell Barton: There is an inconsistency in PyUnicode_EncodeFSDefault(), on Linux its argument is checked to be unicode, and NULL is returned when its not. On windows however, this throws an assertion. The problem with this is, in some CAPI code you may pass an argument and check for NULL as an error case, and allow the python API's exception to be exposed to the script author. The problem here is a linux developer can use PyUnicode_EncodeFSDefault() this way, but not a windows developer. A simplified use case below of a case where PyUnicode_EncodeFSDefault would fail. Attached a fix so windows and posix systems behave the same. --- const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) { if (PyBytes_Check(py_str)) { return PyBytes_AS_STRING(py_str); } else if ((*coerce = PyUnicode_EncodeFSDefault(py_str))) { return PyBytes_AS_STRING(*coerce); } --- Also: heres a list to the bug report in blenders tracker, where the bug was found. https://projects.blender.org/tracker/index.php?func=detail&aid=31856&group_id=9&atid=498 -- files: fix_unicode.diff keywords: patch messages: 169816 nosy: ideasman42 priority: normal severity: normal status: open title: PyUnicode_EncodeFSDefault win32 inconsistancy. Added file: http://bugs.python.org/file27114/fix_unicode.diff ___ Python tracker <http://bugs.python.org/issue15859> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.
Changes by Campbell Barton : -- components: +Unicode, Windows nosy: +ezio.melotti versions: +Python 3.2, Python 3.3 ___ Python tracker <http://bugs.python.org/issue15859> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12530] cpython 3.3, __class__ missing.
Campbell Barton added the comment: Shouldn't it be documented that it changes still? - since people are using pytjon3.2 and its a stable release, _any_ breaking change should be documented IMHO -- ___ Python tracker <http://bugs.python.org/issue12530> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12530] cpython 3.3, __class__ missing.
Campbell Barton added the comment: checked for docs here: http://docs.python.org/dev/whatsnew/3.3.html -- ___ Python tracker <http://bugs.python.org/issue12530> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12530] cpython 3.3, __class__ missing.
New submission from Campbell Barton : In python 3.2 this works and prints , in cpython hg: 71296:ab162f925761 it fails with: NameError: global name '__class__' is not defined Since this change is not documented I assume its a bug. --- snip --- class Test: def __init__(self): print(__class__) -- components: Interpreter Core messages: 140099 nosy: ideasman42 priority: normal severity: normal status: open title: cpython 3.3, __class__ missing. type: behavior versions: Python 3.3 ___ Python tracker <http://bugs.python.org/issue12530> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11612] xml.dom.minidom fail to parse SVG file.
New submission from Campbell Barton : python3.2mu -c "import xml.dom.minidom ; xml.dom.minidom.parse('gnome-cpu-frequency-applet.svg')" --- gives the following traceback Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.2/xml/dom/minidom.py", line 1939, in parse return expatbuilder.parse(file) File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 924, in parse result = builder.parseFile(fp) File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 207, in parseFile parser.Parse(buffer, 0) File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 354, in first_element_handler self.start_element_handler(name, attributes) File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 779, in start_element_handler uri, localname, prefix, qname = _parse_ns_name(self, aname) File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 127, in _parse_ns_name uri, localname = parts ValueError: too many values to unpack (expected 2) -- components: Extension Modules files: gnome-cpu-frequency-applet.svg messages: 131479 nosy: ideasman42 priority: normal severity: normal status: open title: xml.dom.minidom fail to parse SVG file. type: crash versions: Python 3.2 Added file: http://bugs.python.org/file21302/gnome-cpu-frequency-applet.svg ___ Python tracker <http://bugs.python.org/issue11612> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11432] webbrowser.open on unix fails.
New submission from Campbell Barton : On Linux - tested on: Arch linux @ Debian Squeeze, this fails python -c "__import__('webbrowser').open('http://python.org')" The exception thats raised is: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.2/webbrowser.py", line 70, in open_new_tab return open(url, 2) File "/usr/lib/python3.2/webbrowser.py", line 62, in open if browser.open(url, new, autoraise): File "/usr/lib/python3.2/webbrowser.py", line 276, in open success = self._invoke(args, True, autoraise) File "/usr/lib/python3.2/webbrowser.py", line 239, in _invoke stderr=inout, preexec_fn=setsid) File "/usr/lib/python3.2/subprocess.py", line 736, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.2/subprocess.py", line 1330, in _execute_child raise child_exception_type(errno_num, err_msg) OSError: [Errno 9] Bad file descriptor Noticed that this wont raise an error when stdin arg isn't passed to Popen: line 237: p = subprocess.Popen(cmdline, close_fds=True, stdin=inout, Removing tdin=inout makes firefox load ok, however this is there for a reason so its not a useful fix ofcourse. -- components: Extension Modules messages: 130245 nosy: ideasman42 priority: normal severity: normal status: open title: webbrowser.open on unix fails. versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue11432> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11147] _Py_ANNOTATE_MEMORY_ORDER has unused argument, effects code which includes Python.h
New submission from Campbell Barton : Hi, Im buildiong blender3d with -Werror and python 3.2 gives an error which doesnt happen in 3.1. Tested with SVN r88378. on linux. --- cc1: warnings being treated as errors In file included from /opt/py32/include/python3.2d/Python.h:52:0, from /data/src/blender/blender/source/blender/python/intern/bpy_app.h:27, from /data/src/blender/blender/source/blender/python/intern/bpy_app.c:25: /opt/py32/include/python3.2d/pyatomic.h: In function '_Py_ANNOTATE_MEMORY_ORDER': /opt/py32/include/python3.2d/pyatomic.h:59:48: error: unused parameter 'address' There are 2 ways to solve this: pyatomic.h could include the line: (void)address; Or the macro's which do nothing could be changed from... #define _Py_ANNOTATE_HAPPENS_BEFORE(blah) /* empty */ to... #define _Py_ANNOTATE_HAPPENS_BEFORE(blah) (void)blah -- messages: 128165 nosy: ideasman42 priority: normal severity: normal status: open title: _Py_ANNOTATE_MEMORY_ORDER has unused argument, effects code which includes Python.h type: compile error versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue11147> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10603] __file__ not usable, with certain paths on windows XP.
Campbell Barton added the comment: This is fixed in 3.2a4. -- ___ Python tracker <http://bugs.python.org/issue10603> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10603] __file__ not usable, with certain paths on windows XP.
New submission from Campbell Barton : # create this path. # it could be made by any application but including this line # so encoding is not confused. # c:\äöü __import__("os").mkdir(b'c:\\\xe4\xf6\xfc') # Now create a new script and save in the newly created dir c:\äöü\test.py # In c:\äöü\test.py add the following line __import__("os").listdir(os.path.dirname(__file__)) # Now run the script from the command line using its absolute path. c:\Python31\python.exe c:\äöü\test.py --- This gives an error. Traceback (most recent call last): File "m:\\xc3\xa4\xc3\xb6\xc3¼\test.py", line 2, in WindowsError: [Error 3] The system cannot find the path specified: 'm:\\\xc3\xa4\xc3\xb6\xc3¼\\*.*' This is a bug because a script should be able to inspect the path where it is located. -- components: Interpreter Core messages: 123063 nosy: ideasman42 priority: normal severity: normal status: open title: __file__ not usable, with certain paths on windows XP. type: behavior versions: Python 3.1 ___ Python tracker <http://bugs.python.org/issue10603> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10600] surrogateescape'd paths not readable on Windows XP.
Campbell Barton added the comment: This bug is with blender3d, were the paths are stored internally in C as simple char arrays - bytes. We could expose all path names as bytes too through our C/python API, this would at least be a 1:1 mapping, however Id prefer using strings if possible. Since blender projects need to be portable - compress entire projects and run on different systems, we cant ensure the native fs encoding is used. So surrogateescape seems to work very well, except for this one case I've run into, windows only. -- ___ Python tracker <http://bugs.python.org/issue10600> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10600] surrogateescape'd paths not readable on Windows XP.
Campbell Barton added the comment: note, this bug was reported to me by a user running windows 7, 64bits. -- ___ Python tracker <http://bugs.python.org/issue10600> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10600] surrogateescape'd paths not readable on Windows XP.
New submission from Campbell Barton : Attached is a script which works in linux but not windows XP 32bit with Python 3.1.3. The problem is that the path can be written to when specified as bytes but when escaped it fails. -- components: IO files: utf8_surrogateescape.py messages: 123022 nosy: ideasman42 priority: normal severity: normal status: open title: surrogateescape'd paths not readable on Windows XP. versions: Python 3.1 Added file: http://bugs.python.org/file19896/utf8_surrogateescape.py ___ Python tracker <http://bugs.python.org/issue10600> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9713] Py_CompileString fails on non decode-able paths.
New submission from Campbell Barton : On linux I have a path which python reads as... /data/test/num\udce9ro_bad/untitled.blend os.listdir("/data/test/") returns this ['num\udce9ro_bad'] But the same path cant be given to the C api's Py_CompileString Where fn is '/data/test/num\udce9ro_bad/untitled.blend/test.py' Py_CompileString(buf, fn, Py_file_input); ...gives this error. UnicodeDecodeError: 'utf8' codec can't decode bytes in position 14-16: invalid data >From this pep, non decode-able paths should use surrogateescape's http://www.python.org/dev/peps/pep-0383/ -- components: None messages: 115202 nosy: ideasman42 priority: normal severity: normal status: open title: Py_CompileString fails on non decode-able paths. type: behavior versions: Python 3.1 ___ Python tracker <http://bugs.python.org/issue9713> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9499] Python C/API Execution namespace undocumented. (patch included)
New submission from Campbell Barton : Some parts of the python api expect __main__ module dictionary to be the namespace when executing a script, this is true when running a python script from the python binary but NOT true when running a compiled script from the C/API which can lead to bugs which are not easy to solve unless the C/API author knows this. -- assignee: d...@python components: Documentation files: doc_py3_main_mod.diff keywords: patch messages: 112706 nosy: d...@python, ideasman42 priority: normal severity: normal status: open title: Python C/API Execution namespace undocumented. (patch included) type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file18357/doc_py3_main_mod.diff ___ Python tracker <http://bugs.python.org/issue9499> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6914] Py_SetPythonHome, undocumented behavoir
New submission from Campbell Barton : Py_SetPythonHome holds a pointer to the variable passed, this is not documented so passing a variable on the stack will not work as expected unless its static or allocated. -- components: None messages: 92642 nosy: ideasman42 severity: normal status: open title: Py_SetPythonHome, undocumented behavoir type: behavior versions: Python 3.1 ___ Python tracker <http://bugs.python.org/issue6914> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6913] Py_SetPythonHome incorrectly documented py3.x (rev 74792)
New submission from Campbell Barton : Py_SetPythonHome takes a *wchar_t not a *char, this is obvious from looking at the header, However I tried using this function and couldn't get it working until I made the home variable a static string. when looking at the source this is obvious, but should be documented... void Py_SetPythonHome(wchar_t *home) { default_home = home; } -- assignee: georg.brandl components: Documentation files: Py_SetPythonHome_doc.diff keywords: patch messages: 92640 nosy: georg.brandl, ideasman42 severity: normal status: open title: Py_SetPythonHome incorrectly documented py3.x (rev 74792) type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file14891/Py_SetPythonHome_doc.diff ___ Python tracker <http://bugs.python.org/issue6913> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6616] PyList_APPEND (append without incref)
Campbell Barton added the comment: Hi Raymond, in general I agree with your comments that adding 2 ways to do things is not great. The reason I still think this is an advantage is that I know the API well enough (with manipulating dicts/lists etc) and I still want this function for the sake of convenience. For the same reason that PyList_SET_ITEM is useful, this is useful too. Loosing the error checking is a disadvantage but in many cases API's dont do error checking for every new item allocated. Python's own code does this in a few cases with PyList_SET_ITEM... eg. ./Python/_warnings.c:857: PyList_SET_ITEM(filters, 1, create_filter(PyExc_ImportWarning, "ignore")) ./Python/Python-ast.c:2757: PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i))); -- ___ Python tracker <http://bugs.python.org/issue6616> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6616] PyList_APPEND (append without incref)
New submission from Campbell Barton : This patch was made on python r74276 Often when writing in C/Python I want to append to a list within a C loop of an unknown length. When this is done for newly created PyObject (which is quite common) - you need to assign each item to a variable and then decref it. eg: PyObject *item= PyFloat_FromDouble(x); PyList_Append(list, item); Py_DECREF(item); I have seen people make mistakes with this (in pygame code and blender3d), and run PyList_Append(list, PyFloat_FromDouble(x)), ofcourse this is not the fault of python/c api that devs do not read docs properly but I think it would be very convenient to have an append that works in a similar way to PyList_SET_ITEM This simple patch allows... PyList_APPEND(list, PyFloat_FromDouble(x)) doc included. -- files: py3_APPEND.diff keywords: patch messages: 91167 nosy: ideasman42 severity: normal status: open title: PyList_APPEND (append without incref) versions: Python 3.2 Added file: http://bugs.python.org/file14619/py3_APPEND.diff ___ Python tracker <http://bugs.python.org/issue6616> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6439] Demo/embed/demo.c use of PySys_SetArgv() is invalid
Changes by Campbell Barton : -- type: -> compile error ___ Python tracker <http://bugs.python.org/issue6439> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6439] Demo/embed/demo.c use of PySys_SetArgv() is invalid
New submission from Campbell Barton : in python 3.2 (current rev 73893) Demo/embed/demo.c passes a 'char **' to PySys_SetArgv rather then a 'wsize_t **' Im also confused as to how this conversion should be made in a portable way, without copying some farily large static functions from python's code. -- components: Demos and Tools messages: 90267 nosy: ideasman42 severity: normal status: open title: Demo/embed/demo.c use of PySys_SetArgv() is invalid versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue6439> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6284] C/API PyErr_AsUnicode()
Campbell Barton added the comment: Updated with an PyErr_DisplayEx function that accepts a file argument. -- Added file: http://bugs.python.org/file14308/PyErr_AsUnicode_r73443.diff ___ Python tracker <http://bugs.python.org/issue6284> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6284] C/API PyErr_AsUnicode()
Campbell Barton added the comment: Thanks for the feedback, I wasnt aware of PyErr_Display, its not documented as far as I know. http://docs.python.org/dev/py3k/genindex-all.html For blender, its development id still in progress so we don't yet have an internal console replacement. however we use a number of python apis in blender (game engine api, UI api, wrapping our own data) - So there are a number of places where this function could come in handy, and completely replacing the stdout isn't always an option - when running the game engine for instance. Ill look into using a PyErr_DisplayEx -- ___ Python tracker <http://bugs.python.org/issue6284> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6284] C/API PyErr_AsUnicode()
Changes by Campbell Barton : Added file: http://bugs.python.org/file14301/PyErr_AsUnicode_r73429.diff ___ Python tracker <http://bugs.python.org/issue6284> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6284] C/API PyErr_AsUnicode()
Changes by Campbell Barton : Removed file: http://bugs.python.org/file14300/PyErr_AsUnicode_r73429.diff ___ Python tracker <http://bugs.python.org/issue6284> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6284] C/API PyErr_AsUnicode()
Changes by Campbell Barton : Removed file: http://bugs.python.org/file14299/PyErr_AsUnicode_r73429.diff ___ Python tracker <http://bugs.python.org/issue6284> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6284] C/API PyErr_AsUnicode()
Campbell Barton added the comment: last patch was bad heres a new one. -- Added file: http://bugs.python.org/file14300/PyErr_AsUnicode_r73429.diff ___ Python tracker <http://bugs.python.org/issue6284> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6284] C/API PyErr_AsUnicode()
New submission from Campbell Barton : This function returns the output of PyErr_Print as a unicode string. We needed this in Blender3D because it has its own error logging system which does not use the console. The patch is made against python3k r73429. -- components: None files: PyErr_AsUnicode_r73429.diff keywords: patch messages: 89357 nosy: ideasman42 severity: normal status: open title: C/API PyErr_AsUnicode() versions: Python 3.1 Added file: http://bugs.python.org/file14299/PyErr_AsUnicode_r73429.diff ___ Python tracker <http://bugs.python.org/issue6284> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5967] PyList_GetSlice does not indicate negative ranges dont work as in python.
Campbell Barton added the comment: added to setslice too, fixed spelling error. -- Added file: http://bugs.python.org/file13938/slice.diff ___ Python tracker <http://bugs.python.org/issue5967> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5967] PyList_GetSlice does not indicate negative ranges dont work as in python.
Changes by Campbell Barton : Removed file: http://bugs.python.org/file13922/slice.diff ___ Python tracker <http://bugs.python.org/issue5967> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5967] PyList_GetSlice does not indicate negative ranges dont work as in python.
New submission from Campbell Barton : simple patch, docs say that PyList_GetSlice() works like list[high:low], but does not say that negative indices's dont work as with python slicing. -- assignee: georg.brandl components: Documentation files: slice.diff keywords: patch messages: 87438 nosy: georg.brandl, ideasman42 severity: normal status: open title: PyList_GetSlice does not indicate negative ranges dont work as in python. type: behavior versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file13922/slice.diff ___ Python tracker <http://bugs.python.org/issue5967> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com