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
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>
___
___
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
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
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
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
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)
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
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
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
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
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
<
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
Eugene K. added the comment:
File attached
--
Added file: http://bugs.python.org/file39895/bug.py
___
Python tracker
<http://bugs.python.org/issue24587>
___
___
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
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
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
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
Changes by Eugene Toder :
--
nosy: +eltoder
___
Python tracker
<http://bugs.python.org/issue24991>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
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)
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
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
Eugene Toder added the comment:
Fairly sure it's 5 years old.
--
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bugs-list mailing list
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
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
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
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
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
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
Changes by Eugene Bright :
--
type: -> behavior
versions: +Python 3.4
___
Python tracker
<http://bugs.python.org/issue23535>
___
___
Python-bugs-list mai
Eugene Bright added the comment:
Sorry for disturbing.
I'll read docs more careful next time.
--
___
Python tracker
<http://bugs.python.org/issue23535>
___
___
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.
--
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
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
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
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
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
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
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
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
101 - 142 of 142 matches
Mail list logo