[issue35523] Remove old ctypes callback workaround: creating the first instance of a callback

2021-01-24 Thread Campbell Barton
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/issue35

[issue35523] Remove old ctypes callback workaround: creating the first instance of a callback

2021-01-24 Thread Campbell Barton
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

[issue9499] DOC: C/API Execution namespace undocumented. (patch included)

2020-11-01 Thread Campbell Barton
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/issue9

[issue41802] Missing documentation for 'PyDict_DelItem' behavior

2020-09-17 Thread Campbell Barton
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

[issue41802] Missing documentation for 'PyDict_DelItem' behavior

2020-09-17 Thread Campbell Barton
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

[issue32354] Unclear intention of deprecating Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER

2017-12-18 Thread Campbell Barton
Campbell Barton <ideasma...@gmail.com> 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 PyO

[issue32354] Unclear intention of deprecating Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER

2017-12-17 Thread Campbell Barton
New submission from Campbell Barton <ideasma...@gmail.com>: 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 whic

[issue27096] Ability to get random bytes from random.Random (as with os.urandom)

2016-05-24 Thread Campbell Barton
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

[issue27096] Ability to get random bytes from random.Random (as with os.urandom)

2016-05-23 Thread Campbell Barton
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

[issue27096] Ability to get random bits from random.Random (as with os.urandom)

2016-05-23 Thread Campbell Barton
Campbell Barton added the comment: Correction, meant to write: random.randbytes(n). -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27096] Ability to get random bits from random.Random (as with os.urandom)

2016-05-23 Thread Campbell Barton
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

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread Campbell Barton
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

[issue27072] random.getrandbits is limited to 2**31-1 bits on 64-bit Windows

2016-05-21 Thread Campbell Barton
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 <rep...@bugs.pyth

[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows

2015-12-20 Thread Campbell Barton
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 su

[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.

2014-10-14 Thread Campbell Barton
Changes by Campbell Barton ideasma...@gmail.com: -- resolution: out of date - remind ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15859

[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.

2014-10-14 Thread Campbell Barton
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

[issue16123] IDLE - deprecate running without a subprocess

2012-12-04 Thread Campbell Barton
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

[issue16123] IDLE - deprecate running without a subprocess

2012-12-04 Thread Campbell Barton
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 rep...@bugs.python.org http://bugs.python.org/issue16123

[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.

2012-11-27 Thread Campbell Barton
Campbell Barton added the comment: patch attached, simply wraps putenv() -- keywords: +patch Added file: http://bugs.python.org/file28144/pyos_putenv.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16129

[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.

2012-10-05 Thread Campbell Barton
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

[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.

2012-10-04 Thread Campbell Barton
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

[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.

2012-09-03 Thread Campbell Barton
Changes by Campbell Barton ideasma...@gmail.com: -- components: +Unicode, Windows nosy: +ezio.melotti versions: +Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15859

[issue15859] PyUnicode_EncodeFSDefault win32 inconsistancy.

2012-09-03 Thread Campbell Barton
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

[issue12530] cpython 3.3, __class__ missing.

2011-07-11 Thread Campbell Barton
Campbell Barton ideasma...@gmail.com 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 rep

[issue12530] cpython 3.3, __class__ missing.

2011-07-10 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: In python 3.2 this works and prints class '__main__.Test', 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

[issue12530] cpython 3.3, __class__ missing.

2011-07-10 Thread Campbell Barton
Campbell Barton ideasma...@gmail.com added the comment: checked for docs here: http://docs.python.org/dev/whatsnew/3.3.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12530

[issue11612] xml.dom.minidom fail to parse SVG file.

2011-03-19 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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 string, line 1, in module File /usr/lib/python3.2/xml/dom

[issue11432] webbrowser.open on unix fails.

2011-03-07 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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 string, line 1, in module File /usr

[issue11147] _Py_ANNOTATE_MEMORY_ORDER has unused argument, effects code which includes Python.h

2011-02-07 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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

[issue10603] __file__ not usable, with certain paths on windows XP.

2010-12-02 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: # 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:\äöü

[issue10603] __file__ not usable, with certain paths on windows XP.

2010-12-02 Thread Campbell Barton
Campbell Barton ideasma...@gmail.com added the comment: This is fixed in 3.2a4. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10603

[issue10600] surrogateescape'd paths not readable on Windows XP.

2010-12-01 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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

[issue10600] surrogateescape'd paths not readable on Windows XP.

2010-12-01 Thread Campbell Barton
Campbell Barton ideasma...@gmail.com added the comment: note, this bug was reported to me by a user running windows 7, 64bits. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10600

[issue10600] surrogateescape'd paths not readable on Windows XP.

2010-12-01 Thread Campbell Barton
Campbell Barton ideasma...@gmail.com 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

[issue9713] Py_CompileString fails on non decode-able paths.

2010-08-30 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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

[issue9499] Python C/API Execution namespace undocumented. (patch included)

2010-08-03 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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

[issue6913] Py_SetPythonHome incorrectly documented py3.x (rev 74792)

2009-09-14 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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

[issue6914] Py_SetPythonHome, undocumented behavoir

2009-09-14 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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

[issue6616] PyList_APPEND (append without incref)

2009-08-01 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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

[issue6616] PyList_APPEND (append without incref)

2009-08-01 Thread Campbell Barton
Campbell Barton ideasma...@gmail.com 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

[issue6439] Demo/embed/demo.c use of PySys_SetArgv() is invalid

2009-07-08 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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

[issue6439] Demo/embed/demo.c use of PySys_SetArgv() is invalid

2009-07-08 Thread Campbell Barton
Changes by Campbell Barton ideasma...@gmail.com: -- type: - compile error ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6439 ___ ___ Python-bugs

[issue6284] C/API PyErr_AsUnicode()

2009-06-16 Thread Campbell Barton
Campbell Barton ideasma...@gmail.com 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

[issue6284] C/API PyErr_AsUnicode()

2009-06-16 Thread Campbell Barton
Campbell Barton ideasma...@gmail.com 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 rep...@bugs.python.org http

[issue6284] C/API PyErr_AsUnicode()

2009-06-14 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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

[issue6284] C/API PyErr_AsUnicode()

2009-06-14 Thread Campbell Barton
Campbell Barton ideasma...@gmail.com added the comment: last patch was bad heres a new one. -- Added file: http://bugs.python.org/file14300/PyErr_AsUnicode_r73429.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6284

[issue6284] C/API PyErr_AsUnicode()

2009-06-14 Thread Campbell Barton
Changes by Campbell Barton ideasma...@gmail.com: Removed file: http://bugs.python.org/file14299/PyErr_AsUnicode_r73429.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6284

[issue6284] C/API PyErr_AsUnicode()

2009-06-14 Thread Campbell Barton
Changes by Campbell Barton ideasma...@gmail.com: Removed file: http://bugs.python.org/file14300/PyErr_AsUnicode_r73429.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6284

[issue6284] C/API PyErr_AsUnicode()

2009-06-14 Thread Campbell Barton
Changes by Campbell Barton ideasma...@gmail.com: Added file: http://bugs.python.org/file14301/PyErr_AsUnicode_r73429.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6284

[issue5967] PyList_GetSlice does not indicate negative ranges dont work as in python.

2009-05-08 Thread Campbell Barton
New submission from Campbell Barton ideasma...@gmail.com: 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

[issue5967] PyList_GetSlice does not indicate negative ranges dont work as in python.

2009-05-08 Thread Campbell Barton
Changes by Campbell Barton ideasma...@gmail.com: Removed file: http://bugs.python.org/file13922/slice.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5967

[issue5967] PyList_GetSlice does not indicate negative ranges dont work as in python.

2009-05-08 Thread Campbell Barton
Campbell Barton ideasma...@gmail.com added the comment: added to setslice too, fixed spelling error. -- Added file: http://bugs.python.org/file13938/slice.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5967