[issue16602] weakref can return an object with 0 refcount

2012-12-03 Thread Eugene Toder
New submission from Eugene Toder: An interaction between weakrefs and trashcan can cause weakref to return the object it's pointing to after object's refcount is already 0. Given that the object is usually increfed and decrefed, this leads to double dealloc and crashing or hangi

[issue16602] weakref can return an object with 0 refcount

2012-12-04 Thread Eugene Toder
Eugene Toder added the comment: Agreed. That's what I've put in my code as a work around. -- ___ Python tracker <http://bugs.python.org/issue16602> ___ ___

[issue16602] weakref can return an object with 0 refcount

2012-12-08 Thread Eugene Toder
Eugene Toder added the comment: Thank you, Antoine. This change has one effect that's worth highlighting in NEWS at least -- the PyWeakref_GET_OBJECT() macro now evaluates its argument twice. This can break existing code where the argument has side-effects, e.g. o = PyWeakref_GET_OBJ

[issue16602] weakref can return an object with 0 refcount

2012-12-08 Thread Eugene Toder
Eugene Toder added the comment: > People should simply avoid doing this kind of thing, as it's knowingly > fragile, and trivial to avoid anyway. Is this documented in the C API guide, or somewhere else? In any case, notifying people so they can quickly check their code seems much

[issue1062277] Pickle breakage with reduction of recursive structures

2012-12-28 Thread Eugene Toder
Eugene Toder added the comment: To recap, the issue is that pickle doesn't handle recursion via reduce arguments (i.e. arguments to the constructor function as returned in 2nd element of the tuple from __reduce__). This leads to 2 kind of effects: class C: def __init__(self, x

[issue1062277] Pickle breakage with reduction of recursive structures

2012-12-28 Thread Eugene Toder
Changes by Eugene Toder : -- versions: +Python 3.3, Python 3.4 -Python 3.1 ___ Python tracker <http://bugs.python.org/issue1062277> ___ ___ Python-bugs-list mailin

[issue11983] Inconsistent hash and comparison for code objects

2013-01-16 Thread Eugene Toder
Eugene Toder added the comment: My comment will make more sense if you follow the links that I provided. Brett's check-in (http://hg.python.org/cpython-fullhistory/rev/8127a55a57cb) says that it fixes bug #1190011 (http://www.mail-archive.com/python-bugs-list@python.org/msg02440.html)

[issue11983] Inconsistent hash and comparison for code objects

2013-01-19 Thread Eugene Toder
Eugene Toder added the comment: If you add co_firstlineno into code_hash you can say something like /* The rest isn't used in hash and comparisons, except co_name and co_firstlineno, which are preserved for tracebacks and debuggers. */ (Otherwise you'd need to explain why co_f

[issue7932] print statement delayed IOError when stdout has been closed

2014-06-22 Thread Eugene Tang
Eugene Tang added the comment: A similar problem seems to appear in Python 3.5 ./python -c 'import sys; print("x", file=sys.stdout)' 1>&- ; echo $? 0 ./python -c 'import sys; print("x", file=sys.stderr)' 2>&- ; echo $? x 0 but a

[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer

2017-01-31 Thread Eugene Toder
Eugene Toder added the comment: > We have already Constant and NameConstant. So it seems there are no need for > None, Bool, TupleConst, SetConst nodes. Yes, Constant is Victor's version of Lit. > I think converting Num, Str, Bytes, Ellipsis into Constant in folding stage &g

[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer

2017-02-01 Thread Eugene Toder
Eugene Toder added the comment: Yes, doing optimizations on AST in CPython is unlikely to give any sizable speed improvements in real world programs. Python as a language is not suited for static optimization, and even if you manage to inline a function, there's still CPython's i

[issue11597] Can't get ConfigParser.write to write unicode strings

2013-04-25 Thread Eugene Klimov
Eugene Klimov added the comment: some workaround import configparser import codecs cfg = configparser.ConfigParser() cfg.write(codecs.open('filename','wb+','utf-8')) -- nosy: +Eugene.Klimov ___ Python tracker <

[issue24587] Incorrect tkinter behavior of slave widgets of Button

2015-07-07 Thread Eugene K.
New submission from Eugene K.: I've encountered this while trying to write a program that allowed the user to edit button labels, by creating an Entry widget on top of the Button, and then hiding the Button. Sample code: http://pastebin.com/WvBbLsNj According to feedback

[issue24587] Incorrect tkinter behavior of slave widgets of Button

2015-07-11 Thread Eugene K.
Eugene K. added the comment: File attached -- Added file: http://bugs.python.org/file39895/bug.py ___ Python tracker <http://bugs.python.org/issue24587> ___ ___

[issue24587] Tkinter stacking versus focus behavior on Windows

2015-07-11 Thread Eugene K.
Eugene K. added the comment: It may not be a pure Python bug, but it's definitely at least a tk bug (which makes it a Python bug as long as tk is the canonical UI package in Python.) Workarounds are nice, but a workaround fixes my specific problem here and now, while leaving unknown nu

[issue24912] The type of cached objects is mutable

2015-09-01 Thread Eugene Toder
Eugene Toder added the comment: Nathaniel, what if we allow creating module objects from an existing dict instead of always creating a new one. Does this solve your namespace diversion problem? FWIW, when I discovered this change I was quite surprised this came through without a PEP. I agree

[issue24912] The type of cached objects is mutable

2015-09-01 Thread Eugene Toder
Eugene Toder added the comment: Guido: IIUC the general intention is to support @property and __getattr__ style hooks on the module level. Assigning to sys.modules[name] from the module itself is a bit too late -- there's already a global dict for this module, and no way to create a m

[issue24982] shutil.make_archive doesn't archive empty directories

2015-09-01 Thread Eugene Kolo
New submission from Eugene Kolo: Zip file is sometimes known to only contain files and the paths to them, but it can also have have empty folders, they are zero length files with a flag set. make_archive just ignores empty directories, I propose that there should either be a flag, or it

[issue24991] Define instance mutability explicitly on type objects

2015-09-03 Thread Eugene Toder
Changes by Eugene Toder : -- nosy: +eltoder ___ Python tracker <http://bugs.python.org/issue24991> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1062277] Pickle breakage with reduction of recursive structures

2015-11-21 Thread Eugene Toder
Eugene Toder added the comment: Davis, the possible cases (i.e. recursion via appropriate mutable objects) are already supported, and the impossible cases are, well, impossible. The only open issue is whether to implement better error handling for infinite recursion problems, instead of

[issue25811] return from random.shuffle

2015-12-05 Thread Eugene Yunak
New submission from Eugene Yunak: random.shuffle operates on a list, and changes it in place. I think returning a reference to this list, the same one we got in as the argument, is quite useful and makes it possible to use random.shuffle in chained function calls, e.g.: somelist.append

[issue26385] the call of tempfile.NamedTemporaryFile fails and leaves a file on the disk

2016-02-18 Thread Eugene Viktorov
New submission from Eugene Viktorov: When calling the tempfile.NamedTemporaryFile with mode='wr' or with any other wrong value for "mode", it raises the ValueError and silently leaves an unknown, just created file on the file system. -- components: Library (Lib)

[issue23640] int.from_bytes() is broken for subclasses

2016-05-11 Thread Eugene Toder
Eugene Toder added the comment: There's a similar issue with replace() methods on date/time/datetime classes. They create instances of derived types without calling derived __new__/__init__, thus potentially leaving those uninitialized. >>> from datetime import date &g

[issue23640] int.from_bytes() is broken for subclasses

2016-05-11 Thread Eugene Toder
Eugene Toder added the comment: They sure do. Check the example in my comment, or if you prefer the source code, it's pretty clear as well: https://hg.python.org/cpython/file/fff0c783d3db/Modules/_datetimemodule.c#l2770 -- ___ Python tracker

[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer

2016-05-14 Thread Eugene Toder
Eugene Toder added the comment: Fairly sure it's 5 years old. -- ___ Python tracker <http://bugs.python.org/issue11549> ___ ___ Python-bugs-list mailing list

[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer

2016-05-15 Thread Eugene Toder
Eugene Toder added the comment: Serhiy: Nice! Yes, _PyCode_ConstantKey solved the problem. But #16619 went in the opposite direction of this patch, and introduced a new type of literal node instead of unifying the existing ones. Kind of a shame, since *this* patch, I believe, both fixes that

[issue20371] datetime.datetime.replace bypasses a subclass's __new__

2016-05-15 Thread Eugene Toder
Eugene Toder added the comment: Properly supporting subclasses in replace() is hard, at least without some cooperation from subclasses. For a proper replace() x.replace(a=newval).b == x.b should hold for every b not dependent on a, including ones added by subclasses. That is, it should

[issue20371] datetime.datetime.replace bypasses a subclass's __new__

2016-05-15 Thread Eugene Toder
Eugene Toder added the comment: Yes, this is similar to my second approach. (You need to copy via __reduce__, because __copy__ my have been overriden to return self.) The general problem with it, is that if a subclass is designed to be immutable (probably a common case here), it may not

[issue20371] datetime.datetime.replace bypasses a subclass's __new__

2016-05-15 Thread Eugene Toder
Eugene Toder added the comment: This seems like it can lead to even more subtle bugs when replace() is not overriden. Currently, any extra state in the subclass is left uninitialized, which usually leads to obvious breakage and is relatively easy to trace back to replace(). (I've do

[issue20371] datetime.datetime.replace bypasses a subclass's __new__

2016-05-15 Thread Eugene Toder
Eugene Toder added the comment: namedtuple._replace() actually doesn't call subclass' __new__. It calls tuple.__new__ directly, so it has the same problem as datetime classes. Parameter and Signature are new in 3.3. I'm not sure if they're expected to be used as base class

[issue23535] os.path.join() wrong concatenation of "C:" on Windows

2015-02-27 Thread Eugene Bright
New submission from Eugene Bright: Hello! I found strange os.path.join() behavior on Windows. It works fine in common case. >>> os.path.join("C", "filename") 'C\\filename' But if first argument is "C:" there are no backslashes added at all

[issue23535] os.path.join() wrong concatenation of "C:" on Windows

2015-02-27 Thread Eugene Bright
Changes by Eugene Bright : -- type: -> behavior versions: +Python 3.4 ___ Python tracker <http://bugs.python.org/issue23535> ___ ___ Python-bugs-list mai

[issue23535] os.path.join() wrong concatenation of "C:" on Windows

2015-02-27 Thread Eugene Bright
Eugene Bright added the comment: Sorry for disturbing. I'll read docs more careful next time. -- ___ Python tracker <http://bugs.python.org/issue23535> ___ ___

[issue23726] Don't enable GC for classes that don't add new fields

2015-03-20 Thread Eugene Toder
New submission from Eugene Toder: As far as I can tell, if a new class does not add any new fields, and its base class doesn't use GC, there's no reason to enable GC for the new class. This is useful for creating lightweight wrappers around classes implemented in C. --

[issue23726] Don't enable GC for classes that don't add new fields

2015-03-20 Thread Eugene Toder
Eugene Toder added the comment: Agreed, but this is not new. This works without my change: >>> class Tuple(tuple): ... __slots__ = () ... def __repr__(self): return 'Imma tuple!' ... >>> ().__class

[issue23726] Don't enable GC for classes that don't add new fields

2015-03-20 Thread Eugene Toder
Eugene Toder added the comment: Actually, this is rather new -- new in 3.5. The check was relaxed in #22986: https://hg.python.org/cpython/rev/c0d25de5919e Previously only heap types allowed re-assigning __class__. -- ___ Python tracker <h

[issue23726] Don't enable GC for classes that don't add new fields

2015-03-21 Thread Eugene Toder
Changes by Eugene Toder : Added file: http://bugs.python.org/file38624/class_gc2.diff ___ Python tracker <http://bugs.python.org/issue23726> ___ ___ Python-bugs-list m

[issue23726] Don't enable GC for classes that don't add new fields

2015-04-13 Thread Eugene Toder
Eugene Toder added the comment: Thank you! Benjamin, Nathaniel, any opinion if we should restrict reassigning __class__ for types like tuple, int and str, where some/many instances are cached? -- nosy: +njs ___ Python tracker <h

[issue23726] Don't enable GC for classes that don't add new fields

2015-04-13 Thread Eugene Toder
Eugene Toder added the comment: Agreed. There's a small problem with that, as far as I know. Nothing on type declares that it is immutable. -- ___ Python tracker <http://bugs.python.org/is

[issue39679] functools: singledispatchmethod doesn't work with classmethod

2020-11-02 Thread Eugene-Yuan Kou
Eugene-Yuan Kou added the comment: Hi, I also encounter to the problem, and I have give my attempt to make the singledispatchmethod support the classmethod, and staticmethod with type annotation. I also adding two tests. Please refer to my fork. I will trying to make a pull request https

[issue35487] setup()'s package_data not following directory symlink

2018-12-13 Thread F. Eugene Aumson
New submission from F. Eugene Aumson : I have a package using setup.py. I want the package to include some data files, which are located in my source directory. Building my package in my 3.7.0 environment includes the data files as expected. Building the same exact package in my 3.7.1

[issue35487] setup()'s package_data not following directory symlink

2018-12-13 Thread F. Eugene Aumson
F. Eugene Aumson added the comment: The two environments in question (a 3.7.1 one, and a 3.7.0 one) differ in other ways. I have done an apples-to-apples comparison of those two versions, in the same local environment, and this issue does not exist. Sorry for the noise. -- stage

<    1   2