[issue14231] Fix or drop Lib/test/crashers/borrowed_ref_1.py

2012-03-08 Thread Armin Rigo
Armin Rigo added the comment: Crashes for me on Python 2.5 and 2.6, but no longer on Python 2.7. The problem may have been fixed in the meantime. -- ___ Python tracker <http://bugs.python.org/issue14

[issue14231] Fix or drop Lib/test/crashers/borrowed_ref_1.py

2012-03-09 Thread Armin Rigo
Armin Rigo added the comment: I will attempt a last time to mention that the docstrings in borrowed_ref_*.py used to say they were *examples*. That means: (1) find any internal or external C function that returns a borrowed reference; (2) find all callers and write down all the places that

[issue7946] Convoy effect with I/O bound threads and New GIL

2019-06-25 Thread Armin Rigo
Armin Rigo added the comment: Note that PyPy has implemented a GIL which does not suffer from this problem, possibly using a simpler approach than the patches here do. The idea is described and implemented here: https://bitbucket.org/pypy/pypy/src/default/rpython/translator/c/src

[issue34880] About the "assert" bytecode

2019-08-01 Thread Armin Rigo
Change by Armin Rigo : -- nosy: -arigo ___ Python tracker <https://bugs.python.org/issue34880> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-06-23 Thread Armin Rigo
Changes by Armin Rigo : -- nosy: +arigo ___ Python tracker <http://bugs.python.org/issue30744> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-06-23 Thread Armin Rigo
Armin Rigo added the comment: A version of the same problem without threads, using generators instead to get the bug deterministically. Prints 1, 1, 1, 1 on CPython and 1, 2, 3, 3 on PyPy; in both cases we would rather expect 1, 2, 3, 4. -- Added file: http://bugs.python.org

[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-06-24 Thread Armin Rigo
Armin Rigo added the comment: (Note: x.py is for Python 2.7; for 3.x, of course, replace ``.next()`` with ``.__next__()``. The result is the same) -- ___ Python tracker <http://bugs.python.org/issue30

[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-08 Thread Armin Rigo
New submission from Armin Rigo: The ``os`` functions generally accept any buffer-supporting object as file names, and interpret it as if ``bytes()`` had been called on it. However, ``os.listdir(x)`` uses the type of ``x`` to know if it should return a list of bytes or a list of unicodes

[issue30879] os.listdir(bytes) gives a list of bytes, but os.listdir(buffer) gives a list of unicodes

2017-07-08 Thread Armin Rigo
Armin Rigo added the comment: I've also been pointed to https://bugs.python.org/issue26800 . -- ___ Python tracker <http://bugs.python.org/issue30879> ___ ___

[issue30966] multiprocessing.queues.SimpleQueue leaks 2 fds

2017-07-19 Thread Armin Rigo
New submission from Armin Rigo: multiprocessing.queues.SimpleQueue should have a close() method. This is needed to explicitly release the two file descriptors of the Pipe used internally. Without it, the file descriptors leak if a reference to the SimpleQueue object happens to stay around

[issue31105] Cyclic GC threshold may need tweaks

2017-08-02 Thread Armin Rigo
New submission from Armin Rigo: The cyclic GC uses a simple and somewhat naive policy to know when it must run. It is based on counting "+1" for every call to _PyObject_GC_Alloc(). Explicit calls to PyObject_GC_Del() are counted as "-1". The cyclic GC will only be exec

[issue31119] Signal tripped flags need memory barriers

2017-08-04 Thread Armin Rigo
Armin Rigo added the comment: For reference, no, it can't happen on x86 or x86-64. I've found that this simplified model actually works for reasoning about ordering at the hardware level: think about each core as a cache-less machine that always *reads* from the central RAM, but

[issue31265] Remove doubly-linked list from C OrderedDict

2017-09-10 Thread Armin Rigo
Armin Rigo added the comment: I would side with Inada in thinking they both give the same amortized complexity, but beyond that, benchmarks are the real answer. There is little value in keeping the current implementation of OrderedDict *if* benchmarks show that it is rarely faster

[issue29694] race condition in pathlib mkdir with flags parents=True

2017-03-06 Thread Armin Rigo
Armin Rigo added the comment: A different bug in the same code: if someone creates the directory itself between the two calls to ``self._accessor.mkdir(self, mode)``, then the function will fail with an exception even if ``exist_ok=True``. Attached is a patch that fixes both cases

[issue29694] race condition in pathlib mkdir with flags parents=True

2017-03-24 Thread Armin Rigo
Armin Rigo added the comment: It's a mess to write a test, because the exact semantics of .mkdir() are not defined as far as I can tell. This patch is a best-effort attempt at making .mkdir() work in the presence of common parallel filesystem changes, that is, other processes that

[issue29694] race condition in pathlib mkdir with flags parents=True

2017-03-28 Thread Armin Rigo
Armin Rigo added the comment: Changes including a test. The test should check all combinations of "concurrent" creation of the directory. It hacks around at pathlib._normal_accessor.mkdir (patching "os.mkdir" has no effect, as the built-in function was already extract

[issue29694] race condition in pathlib mkdir with flags parents=True

2017-04-10 Thread Armin Rigo
Armin Rigo added the comment: Maybe we should review pathlib.py for this kind of issues and first apply the fixes and new tests inside PyPy. That sounds like a better way to get things done for these rare issues, where CPython is understandably reluctant to do much changes. Note that the

[issue29694] race condition in pathlib mkdir with flags parents=True

2017-04-12 Thread Armin Rigo
Armin Rigo added the comment: Update: a review didn't show any other similar problems (pathlib.py is a thin layer after all). Applied the fix and test (x2.diff) inside PyPy. -- ___ Python tracker <http://bugs.python.org/is

[issue29694] race condition in pathlib mkdir with flags parents=True

2017-04-12 Thread Armin Rigo
Armin Rigo added the comment: https://github.com/python/cpython/pull/1089 (I fixed the problem with my CLA check. Now https://cpython-devguide.readthedocs.io/pullrequest.html#licensing says "you can ask for the CLA check to be run again" but doesn't tell how to do that, so

[issue30080] Add the --duplicate option for timeit

2017-04-16 Thread Armin Rigo
Changes by Armin Rigo : -- nosy: -arigo ___ Python tracker <http://bugs.python.org/issue30080> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30347] itertools.groupby() can fail a C assert()

2017-05-11 Thread Armin Rigo
New submission from Armin Rigo: This triggers an assert() failure on debug-mode Python (or a leak in release Python): from itertools import groupby def f(n): print("enter:", n) if n == 5: list(b) print("leave:", n) return n != 6 for (k, b) in

[issue18943] argparse: default args in mutually exclusive groups

2017-05-18 Thread Armin Rigo
Changes by Armin Rigo : -- nosy: -arigo ___ Python tracker <http://bugs.python.org/issue18943> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28647] python --help: -u is misdocumented as binary mode

2017-05-24 Thread Armin Rigo
Changes by Armin Rigo : -- nosy: -arigo ___ Python tracker <http://bugs.python.org/issue28647> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue24340] co_stacksize estimate can be highly off

2017-06-03 Thread Armin Rigo
Changes by Armin Rigo : -- versions: +Python 3.7 ___ Python tracker <http://bugs.python.org/issue24340> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue29535] datetime hash is deterministic in some cases

2017-06-03 Thread Armin Rigo
Changes by Armin Rigo : -- pull_requests: +2016 ___ Python tracker <http://bugs.python.org/issue29535> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30480] samefile and sameopenfile fail for WebDAV mapped drives

2017-06-11 Thread Armin Rigo
Armin Rigo added the comment: Another example of this misbehaviour: there are cases where ``os.stat()`` will internally fail to obtain the whole stat info (in some case related to permissions) and silently fall back to the same behaviour as Python 2.7. In particular, it will return a result

[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-24 Thread Armin Rigo
Armin Rigo added the comment: Just so you know, when we look at the changes to CPython, the easiest fix is to add these lines in cffi: #if PY_VERSION_HEX >= 0x0308 # define Py_BUILD_CORE # include "internal/pycore_pystate.h" # undef Py_BUILD_CORE #endif

[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Armin Rigo
Armin Rigo added the comment: @nick the C sources produced by cffi don't change. When they are compiled, they use Py_LIMITED_API so you can continue using a single compiled module version for any recent-enough Python 3.x. The required fix is only inside the cffi module i

[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Armin Rigo
Armin Rigo added the comment: Cool. Also, no bugfix release of cffi was planned, but I can make one if you think it might help for testing the current pre-release of CPython 3.8. -- ___ Python tracker <https://bugs.python.org/issue35

[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-26 Thread Armin Rigo
Armin Rigo added the comment: Done. -- ___ Python tracker <https://bugs.python.org/issue35886> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36124] Provide convenient C API for storing per-interpreter state

2019-03-01 Thread Armin Rigo
Armin Rigo added the comment: PyModule_GetState() requires having the module object that corresponds to the given interpreter state. I'm not sure how a C extension module is supposed to get its own module object corresponding to the current interpreter state, without getting it fro

[issue36229] Avoid unnecessary copies for list, set, and bytearray ops.

2019-03-13 Thread Armin Rigo
Armin Rigo added the comment: This patch is based on the following reasoning: if 'a' is a list and the reference count of 'a' is equal to 1, then we can mutate in-place 'a' in a call to 'a->ob_type->tp_as_sequence->list_concat'. Typicall

[issue36229] Avoid unnecessary copies for list, set, and bytearray ops.

2019-03-13 Thread Armin Rigo
Armin Rigo added the comment: ...or PySequence_Concat() instead of PyNumber_Add(); same reasoning. -- ___ Python tracker <https://bugs.python.org/issue36

[issue1875] "if 0: return" not raising SyntaxError

2019-05-15 Thread Armin Rigo
Change by Armin Rigo : -- nosy: -arigo ___ Python tracker <https://bugs.python.org/issue1875> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32922] dbm.open() encodes filename with default encoding rather than the filesystem encoding

2018-02-23 Thread Armin Rigo
Armin Rigo added the comment: It's not a new feature. See for example all functions from posixmodule.c: it should at least be PyArg_ParseTuple(args, "et", Py_FileSystemDefaultEncoding, &char_star_variable). -- nosy: +arigo ___

[issue29943] PySlice_GetIndicesEx change broke ABI in 3.5 and 3.6 branches

2017-09-26 Thread Armin Rigo
Armin Rigo added the comment: An update to Serhiy's proposed fix: #if PY_VERSION_HEX < 0x0307 && defined(PySlice_GetIndicesEx) #if !defined(PYPY_VERSION) #undef PySlice_GetIndicesEx #endif #endif All PyXxx functions are macros on PyPy, and undefining a macro just make

[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-10-13 Thread Armin Rigo
Armin Rigo added the comment: FWIW, a Psyco-level JIT compiler can support reads from locals() or f_locals, but writes are harder. The need to support writes would likely become another hard step on the way towards adding some simple JIT support to CPython in the future, should you decide

[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-10-13 Thread Armin Rigo
Armin Rigo added the comment: Thanks Nick for the clarification. Yes, that's what I meant: supporting such code in simple JITs is a nightmare. Perhaps more importantly, I am sure that if Python starts supporting random mutation of locals outside tracing hooks, then it would open the

[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-10-13 Thread Armin Rigo
Armin Rigo added the comment: Guido: you must be tired and forgot that locals() is a regular function :-) The compiler cannot recognize it reliably. Moreover, if f_locals can be modified outside a tracing hook, then we have the same problem in a cross-function way, e.g. if function f1

[issue10544] yield expression inside generator expression does nothing

2017-11-24 Thread Armin Rigo
Change by Armin Rigo : -- nosy: -arigo ___ Python tracker <https://bugs.python.org/issue10544> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1617161] Instance methods compare equal when their self's are equal

2017-12-12 Thread Armin Rigo
Armin Rigo added the comment: Sorry, I think it is pointless to spend efforts to keep a relatively uncontroversial and small patch up-to-date, when it was not accepted in 9 years. Someone else would need to take it up. -- ___ Python tracker

[issue17852] Built-in module _io can lose data from buffered files at exit

2017-12-14 Thread Armin Rigo
Change by Armin Rigo : -- nosy: -arigo ___ Python tracker <https://bugs.python.org/issue17852> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1366311] SRE engine should release the GIL when/if possible

2018-05-25 Thread Armin Rigo
Change by Armin Rigo : -- nosy: -arigo ___ Python tracker <https://bugs.python.org/issue1366311> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1617161] Instance methods compare equal when their self's are equal

2018-06-21 Thread Armin Rigo
Change by Armin Rigo : -- nosy: -arigo ___ Python tracker <https://bugs.python.org/issue1617161> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16899] Add support for C99 complex type (_Complex) as ctypes.c_complex

2018-07-04 Thread Armin Rigo
Armin Rigo added the comment: cffi supports complex numbers since release 1.11---for direct calls using the API mode. That means that neither CFFI's ABI mode, nor ctypes, can possibly work yet. The problem is still libffi's own support, which is still not implemented (apart

[issue34123] ambiguous documentation for dict.popitem

2018-07-16 Thread Armin Rigo
Armin Rigo added the comment: Agreed with Raymond. -- ___ Python tracker <https://bugs.python.org/issue34123> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread Armin Rigo
Change by Armin Rigo : -- nosy: -arigo ___ Python tracker <https://bugs.python.org/issue25750> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9134] sre bug: lastmark_save/restore

2018-09-23 Thread Armin Rigo
Change by Armin Rigo : -- nosy: -arigo ___ Python tracker <https://bugs.python.org/issue9134> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34880] About the "assert" bytecode

2018-10-05 Thread Armin Rigo
Armin Rigo added the comment: A middle ground might be to copy the behavior of ``__import__``: it is loaded from the builtins module where specific hacks can change its definition, but it is not loaded from the globals. -- nosy: +arigo ___ Python

[issue18107] 'str(long)' can be made faster

2013-05-31 Thread Armin Rigo
New submission from Armin Rigo: If you have in x some very large number, like 3**20, then the computation for 'str(x)' is sub-efficient. Nathan Hurst posted to the pypy-dev mailing list a pure Python algo that gives the same result in 2/3rd of the time (in either CPython or

[issue18107] 'str(long)' can be made faster

2013-05-31 Thread Armin Rigo
Armin Rigo added the comment: Thanks, I missed it. Sorry for the noise. -- resolution: -> duplicate status: open -> closed ___ Python tracker <http://bugs.python.org/i

[issue18122] RuntimeError: not holding the import lock

2013-06-02 Thread Armin Rigo
New submission from Armin Rigo: A new bug, introduced in recent Python 2.7 (2.7.3 passes, 2.7 trunk fails): With the attached x.py, running "python -c 'import x'" fails with RuntimeError: not holding the import lock. It occurs when doing a fork() while holding the impor

[issue18122] RuntimeError: not holding the import lock

2013-06-03 Thread Armin Rigo
Armin Rigo added the comment: The bug is different, because it doesn't depend on details of the platform. -- ___ Python tracker <http://bugs.python.org/is

[issue18122] RuntimeError: not holding the import lock

2013-06-03 Thread Armin Rigo
Armin Rigo added the comment: Indeed, no clue: it seems I don't get the error only on my system-installed 2.7.3 on Linux 32. I do get it on any other Python I tried, like 2.6.x, or the system-installed 2.7.1 on Linux 64. So it's not actually

[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-04 Thread Armin Rigo
Armin Rigo added the comment: That's not really what I'm after, but that's a workaround I proposed to avoid the worst breakage. I don't have an opinion about what to do with symlinks. -- ___ Python tracker <http://bug

[issue17222] py_compile.compile() replaces target files, breaking special files and symlinks

2013-06-05 Thread Armin Rigo
Armin Rigo added the comment: Brett: I don't really have a constructive opinion on this matter. I could suggest putting a bit more logic in py_compile.compile(cfile=...) to revert to the old behavior if we specify an already-existing target, in order to fix the other reported issue

[issue18033] Example for Profile Module shows incorrect method

2013-06-11 Thread Armin Rigo
Armin Rigo added the comment: A slightly more complete example that I tested: http://stackoverflow.com/a/16077568/1556290 -- nosy: +arigo ___ Python tracker <http://bugs.python.org/issue18

[issue18647] re.error: nothing to repeat

2013-08-10 Thread Armin Rigo
Armin Rigo added the comment: Just a side note for 2.7: could I recommend people to be really extra, extra careful when changing what kind of regexps are accepted and what kind of regexps are outright rejected? I believe the risk of making long-existing and working 2.7 programs suddenly

[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Armin Rigo
Armin Rigo added the comment: Just mentioning it here again, but "type(a).__index__(a)" is still not perfectly correct. Attached is a case where it differs. I think you get always the correct answer by evaluating "range(a).stop". It's admittedly obscure...

[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Armin Rigo
Armin Rigo added the comment: > The difference doesn't look significant. In all cases the TypeError is raised. Ok, so here is another case. (I won't go to great lengths trying to convince you that there is a problem, because the discussion already occurred several times; googl

[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Armin Rigo
Armin Rigo added the comment: This may have been the most recent discussion of this idea (as far as I can tell): http://mail.python.org/pipermail//python-ideas/2012-August/016036.html Basically, it seems to be still unresolved in the trunk Python; sorry, I thought by now it would have been

[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Armin Rigo
Armin Rigo added the comment: Sorry, realized that my pure Python algorithm isn't equivalent to _PyType_Lookup() --- it fails the staticmethod example of Serhiy. A closer one would be: for t in type(a).__mro__: if '__index__' in t.__dict__: re

[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-17 Thread Armin Rigo
Armin Rigo added the comment: For completeness, can you post one line saying why the much simpler solution "range(a).stop" is not accepted? -- ___ Python tracker <http://bugs.python.o

[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-18 Thread Armin Rigo
Armin Rigo added the comment: Ah. If that's the only reason, then that seems a bit like misguided effort... For alternative implementations like PyPy and Jython, the "_operator" module is definitely one of the simplest ones to reimplement in RPython or Java. Eve

[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-18 Thread Armin Rigo
Armin Rigo added the comment: ...but yes, it's very obvious that exposing _PyType_Lookup() to pure Python is the right thing to do here. This is a central part of the way Python works internally, after all. Moreover, sorry about my previous note: if we started today to write PyPy, the

[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread Armin Rigo
Armin Rigo added the comment: @Serhiy: it would certainly break a program that tries to call the repr() and catches the UnicodeEncodeError to do something else, like encode the data differently. -- ___ Python tracker <http://bugs.python.

[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread Armin Rigo
Armin Rigo added the comment: @Serhiy: it's a behavior change and as such not an option for a micro release. For example, the following legal code would behave differently: it would compute s = '\\u1234' instead of s = 'UTF8:\xe1\x88\xb4'. try:

[issue18885] handle EINTR in the stdlib

2013-09-01 Thread Armin Rigo
Changes by Armin Rigo : -- nosy: +arigo ___ Python tracker <http://bugs.python.org/issue18885> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue18943] argparse: default args in mutually exclusive groups

2013-09-06 Thread Armin Rigo
New submission from Armin Rigo: In argparse, default arguments have a strange behavior that shows up in mutually exclusive groups: specifying explicitly on the command-line an argument, but giving it its default value, is sometimes equivalent to not specifying the argument at all, and

[issue18943] argparse: default args in mutually exclusive groups

2013-09-06 Thread Armin Rigo
Changes by Armin Rigo : -- keywords: -patch ___ Python tracker <http://bugs.python.org/issue18943> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18943] argparse: default args in mutually exclusive groups

2013-09-06 Thread Armin Rigo
Changes by Armin Rigo : -- components: +Library (Lib) ___ Python tracker <http://bugs.python.org/issue18943> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18944] Minor mistake in test_set.py

2013-09-06 Thread Armin Rigo
New submission from Armin Rigo: Found a minor mistake in test_set.py. Patch attached. -- components: Interpreter Core files: test_set.diff keywords: patch messages: 197060 nosy: arigo priority: normal severity: normal status: open title: Minor mistake in test_set.py versions: Python

[issue16938] pydoc confused by __dir__

2013-09-06 Thread Armin Rigo
Armin Rigo added the comment: I believe that this describes a problem more general than the problem of Enums from Issue18693: help(x) shouldn't crash in the presence of a __dir__() method that returns unexpected names. -- nosy: +arigo ___ P

[issue18944] Minor mistake in test_set.py

2013-09-06 Thread Armin Rigo
Changes by Armin Rigo : -- assignee: -> tim.peters ___ Python tracker <http://bugs.python.org/issue18944> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue16938] pydoc confused by __dir__

2013-09-06 Thread Armin Rigo
Armin Rigo added the comment: The __objclass__ is a workaround. I don't understand your point. I think the original poster is saying that simply putting a __dir__() method on a class can confuse help() more than would be necessary, and if he's correct I agree

[issue18943] argparse: default args in mutually exclusive groups

2013-09-07 Thread Armin Rigo
Armin Rigo added the comment: Getting consistently one behavior or the other would be much better imho; I think it's wrong-ish to have the behavior depend uncontrollably on implementation details. But I agree that it's slightly messy to declare which of the two possible fixes is

[issue18943] argparse: default args in mutually exclusive groups

2013-09-08 Thread Armin Rigo
Armin Rigo added the comment: Fwiw I agree with you :-) I'm just relaying a bug report that originates on PyPy (https://bugs.pypy.org/issue1595). -- ___ Python tracker <http://bugs.python.org/is

[issue18943] argparse: default args in mutually exclusive groups

2013-09-10 Thread Armin Rigo
Armin Rigo added the comment: The patch looks good to me. It may break existing code, though, as reported on https://bugs.pypy.org/issue1595. I would say that it should only go to trunk. We can always fix PyPy (at Python 2.7) in a custom manner, in a "bug-to-bug" compatib

[issue5057] Unicode-width dependent optimization leads to non-portable pyc file

2012-04-24 Thread Armin Rigo
Armin Rigo added the comment: Sorry to re-open this issue. The following example shows that it was not fully resolved: def f(): return u'\U00023456abcdef'[3] import dis; dis.dis(f) print f() On a wide build it should print 'c' and on a narrow buil

[issue9751] _PyInstance_Lookup() defeats its purpose

2012-05-09 Thread Armin Rigo
Armin Rigo added the comment: Unlike other crashers I'm a bit concerned about this one. It can occur on any code that stores custom instances as keys in the __dict__ of an old-style instance. Such code might be unusual-looking, but certainly not unheard-of. And the segfault that w

[issue5057] Unicode-width dependent optimization leads to non-portable pyc file

2012-05-14 Thread Armin Rigo
Armin Rigo added the comment: Did anyone ever show that this particular detail, which looks like a completely obscure case to me, has any measurable effect on any code whatsoever? Just coming up with numbers, but I'm sure it gives you 5% on the most specially tuned micro-benchmark

[issue15061] hmac.secure_compare() leaks information of length of strings

2012-06-14 Thread Armin Rigo
Armin Rigo added the comment: fijal: while I agree with you, the limit for small ints has actually been pushed to 257 in recent CPythons. So it should still theoretically work --- of course, assuming a predictable CPU, which is wrong, and assuming a simple interpreter. (We can probably dig

[issue15061] hmac.secure_compare() leaks information about length of strings

2012-06-15 Thread Armin Rigo
Changes by Armin Rigo : -- nosy: -arigo ___ Python tracker <http://bugs.python.org/issue15061> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16013] small csv reader bug

2012-09-24 Thread Armin Rigo
New submission from Armin Rigo: A small bug of cvs.reader(): >>> list(csv.reader(['foo:"'], delimiter=':', quotechar='"')) [] Adding strict=True doesn't change anything. This is caused by the opening quote not followed by anything, which

[issue14621] Hash function is not randomized properly

2012-10-21 Thread Armin Rigo
Armin Rigo added the comment: Just to make it extra clear: Vlado showed that the "-R" switch of Python can easily be made fully pointless, with only a bit of extra work. Here is how: * Assume you have an algo that gives you as many strings with colliding hashes as you want, provide

[issue14621] Hash function is not randomized properly

2012-10-21 Thread Armin Rigo
Armin Rigo added the comment: For reference, the above means that we can implement -R support for PyPy as a dummy ignored flag, and get "security" that is very close to CPython's. :-) -- keywords: +easy ___ Python tracker <http

[issue16309] "PYTHONPATH=" different from no PYTHONPATH at all

2012-10-24 Thread Armin Rigo
New submission from Armin Rigo: On Posix, it is documented that setting PATH to the empty string is equivalent to not setting PATH at all, which is an exception to the rule that in a string like "/bin::/usr/bin" the empty string in the middle gets interpreted as ".". PYTH

[issue16309] "PYTHONPATH=" different from no PYTHONPATH at all

2012-10-25 Thread Armin Rigo
Armin Rigo added the comment: Attached the diff, in case we want to do that. The diff is only about non-Windows platforms, given that it follows a Posix use case about PATH. But do we also need to change PC/getpathp.c? -- keywords: +patch Added file: http://bugs.python.org/file27709

[issue16309] "PYTHONPATH=" different from no PYTHONPATH at all

2012-10-25 Thread Armin Rigo
Armin Rigo added the comment: Attached another simpler diff (only one "+" line instead of two...). -- Added file: http://bugs.python.org/file27712/pythonpath2.diff ___ Python tracker <http://bugs.python.o

[issue16345] dict.fromkeys() assumes 'self' is empty

2012-10-28 Thread Armin Rigo
New submission from Armin Rigo: The implementation of dict.fromkeys() assumes that the new dictionary is empty. That's not the case if we tweak __new__. Attached example shows 'dictresize(mp, 0)' being called with 'mp' being dictionary of 10 items. This causes an

[issue16345] dict.fromkeys() assumes 'self' is empty

2012-10-29 Thread Armin Rigo
Armin Rigo added the comment: In case of doubt, see the source code of PyPy :-) w_dict = space.call_function(w_type) for w_key in space.listview(w_keys): space.setitem(w_dict, w_key, w_fill) (Seriously more compact.) No clear there

[issue16345] dict.fromkeys() assumes 'self' is empty

2012-10-29 Thread Armin Rigo
Armin Rigo added the comment: Joke apart, you could check and complain if the object returned is an instance of 'dict' and is not empty. Otherwise just accept it. I think complaining is better than picking either of the two behaviors in

[issue21154] Small fix in 2.7.6 lang ref

2014-04-04 Thread Armin Rigo
New submission from Armin Rigo: The docs still say that the default __hash__() is equal to id(), but that's not the case since Python 2.7. -- assignee: docs@python components: Documentation files: lang-ref-fix.diff keywords: patch messages: 215517 nosy: arigo, docs@python pri

[issue19979] Missing nested scope vars in class scope (bis)

2014-05-19 Thread Armin Rigo
Armin Rigo added the comment: Terry: I meant exactly what I wrote, and not some unrelated examples: def f(): n = 1 class A: n = n doesn't work, but the same two lines ("n = 1"; "class A: n = n") work if written at module level

[issue21778] PyBuffer_FillInfo() from 3.3

2014-06-16 Thread Armin Rigo
New submission from Armin Rigo: Following the documentation at https://docs.python.org/3/c-api/buffer.html, if we write a custom object in C with a getbufferproc that simply returns PyBuffer_FillInfo(...), then it works fine up to Python 3.2 but segfaults in Python 3.3 depending on what we do

[issue21778] PyBuffer_FillInfo() from 3.3

2014-06-16 Thread Armin Rigo
Changes by Armin Rigo : Added file: http://bugs.python.org/file35655/xymodule.c ___ Python tracker <http://bugs.python.org/issue21778> ___ ___ Python-bugs-list mailin

[issue21778] PyBuffer_FillInfo() from 3.3

2014-06-16 Thread Armin Rigo
Armin Rigo added the comment: Ah! Thanks. I systematically missed the "flags" arguments passed in the getbufferproc function. (I thought I had to tell PyBuffer_FillInfo() what kind of format we actually provide, but it seems that the interface is the other way around. I don&#x

[issue21778] PyBuffer_FillInfo() from 3.3

2014-06-16 Thread Armin Rigo
Changes by Armin Rigo : -- resolution: -> not a bug ___ Python tracker <http://bugs.python.org/issue21778> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue14621] Hash function is not randomized properly

2012-11-06 Thread Armin Rigo
Armin Rigo added the comment: Benjamin: oups, sorry. I don't remember setting the "easy" keyword, my mistake. Fwiw I'm +1 on Marc-Andre's solution. Make it a tunable setting, e.g. with sys.setcollisionlimit(). Defaults to sys.maxint on existing Pythons and some s

[issue14621] Hash function is not randomized properly

2012-11-07 Thread Armin Rigo
Armin Rigo added the comment: Marc-André: estimating the risks of giving up on a valid query for a truly random hash, at an overestimated one billion queries per second, in a 2/3 full dictionary: * for 1000: 4E159 years between mistakes * for 100: 12.9 years between mistakes * for 150: 8E9

<    1   2   3   4   >