Eugene Rossokha added the comment:
I find the following behaviour very confusing:
>>> import random
>>> a = bytearray("1234", "utf-8")
>>> b = bytearray("1234", "utf-8")
>>> a == b
True
>>> random.seed(a)
>
New submission from Eugene Rossokha :
https://github.com/python/cpython/blob/master/Lib/random.py#L157
If bytearray is passed as a seed, the function will change it.
It either has to be documented, or the implementation should change.
--
components: Library (Lib)
messages: 392782
nosy
Eugene Toder added the comment:
@cache does not address the problem or any of the concerns brought up in the
thread. Thread-safe @once is a nice idea, but more work of course.
--
___
Python tracker
<https://bugs.python.org/issue42
Eugene Toder added the comment:
Ammar, thank you for the link.
--
___
Python tracker
<https://bugs.python.org/issue42903>
___
___
Python-bugs-list mailin
Eugene Toder added the comment:
As you can see in my original post, the difference between @cache (aka
@lru_cache(None)) and just @lru_cache() is negligible in this case. The
optimization in this PR makes a much bigger difference. At the expense of some
lines of code, that's true.
New submission from Eugene Toder :
It's convenient to use @lru_cache on functions with no arguments to delay doing
some work until the first time it is needed. Since @lru_cache is implemented in
C, it is already faster than manually caching in a closure variable. However,
it can be made
Change by Eugene Toder :
--
nosy: +ncoghlan, vstinner
___
Python tracker
<https://bugs.python.org/issue42125>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eugene Toder :
--
nosy: +brett.cannon
___
Python tracker
<https://bugs.python.org/issue42125>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 Eugene Toder :
If a module has a loader, linecache calls its get_source() passing __name__ as
the argument. This works most of the time, except that the __main__ module has
it set to "__main__", which is commonly not the real name of the module.
Luckily, w
New submission from Eugene Huang :
In the pull request
https://github.com/python/asyncio/pull/452#issue-92245081
the linked comment says that `asyncio._set_running_loop()` is part of the
public asyncio API and will be documented, but I couldn't find any references
to this functi
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
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
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 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:
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
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:
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:
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:
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:
Fairly sure it's 5 years old.
--
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bugs-list mailing list
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:
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
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)
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
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
Changes by Eugene Toder :
--
nosy: +eltoder
___
Python tracker
<http://bugs.python.org/issue24991>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
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
New submission from Eugene:
I am very much begging pardon if this is not the place to ask for, but..
I would like to make a thorough translation of the official Library Reference
and the beginners guide to Python 2.x 3.x in Russian language.
I am aware this type of translation will be placed
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 K. added the comment:
File attached
--
Added file: http://bugs.python.org/file39895/bug.py
___
Python tracker
<http://bugs.python.org/issue24587>
___
___
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 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 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
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:
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
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
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 Bright added the comment:
Sorry for disturbing.
I'll read docs more careful next time.
--
___
Python tracker
<http://bugs.python.org/issue23535>
___
___
Changes by Eugene Bright :
--
type: -> behavior
versions: +Python 3.4
___
Python tracker
<http://bugs.python.org/issue23535>
___
___
Python-bugs-list mai
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
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 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
<
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 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)
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:
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
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:
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:
Agreed. That's what I've put in my code as a work around.
--
___
Python tracker
<http://bugs.python.org/issue16602>
___
___
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:
If I'm not missing something, changing
x in [1,2]
to
x in (1,2)
and
x in {1,2}
to
x in frozenset([1,2])
does not change any error messages.
Agreed that without dynamic compilation we can pretty much only track literals
(including functions and lambdas) ass
Eugene Toder added the comment:
> Method calls on literals are always fair game, though (e.g. you could
> optimise "a b c".split())
What about optimizations that do not change behavior, except for different
error messages? E.g. we can change
y = [1,2][x]
to
y = (1,2)[x]
wh
Eugene Voytitsky added the comment:
Hi all, does someone can answer the questions asked by Keith Briggs in 2004:
> What is the reason for this limit? Can it easily be removed?
> It is causing me many problems.
I also stuck into the problem with this limitation.
Details you can rea
Changes by Eugene Toder :
--
nosy: -eltoder
___
Python tracker
<http://bugs.python.org/issue11816>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eugene Toder added the comment:
They are, when there's a most specific metaclass -- the one which is a subclass
of all others (described here
http://www.python.org/download/releases/2.2.3/descrintro/#metaclasses,
implemented here
http://hg.python.org/cpython/file/ab162f925761/Ob
Eugene Toder added the comment:
I found a problem in constant de-duplication, already performed by compiler,
that needs to be fixed before this change can be merged.
Compiler tries to eliminate duplicate constants by putting them into a dict.
However, "duplicate" in this case do
Eugene Toder added the comment:
Anyone has any thoughts on this?
--
___
Python tracker
<http://bugs.python.org/issue5996>
___
___
Python-bugs-list mailin
Eugene Toder added the comment:
So how about this correction?
--
keywords: +patch
nosy: +belopolsky, georg.brandl
Added file: http://bugs.python.org/file22375/setstate.diff
___
Python tracker
<http://bugs.python.org/issue12
Changes by Eugene Toder :
--
nosy: +alexandre.vassalotti, pitrou
___
Python tracker
<http://bugs.python.org/issue12290>
___
___
Python-bugs-list mailing list
Unsub
New submission from Eugene Toder :
Pickle documentation [1] says:
""" Note: If __getstate__() returns a false value, the __setstate__() method
will not be called upon unpickling. """
However, this isn't quite true. This depends on the version of pickle pro
Eugene Toder added the comment:
Nick, if there's an interest in reviewing the patch I can update the it. I
doubt it needs a lot of changes, given that visitor is auto-generated.
Raymond, the patch contains a rewrite of low-level optimizations to work before
byte code generation,
Eugene Toder added the comment:
Btw, disabling dedup for codes won't be the first exception -- we already avoid
coalescing -0.0 with 0.0 for float and complex, even though they compare equal.
--
___
Python tracker
<http://bugs.py
Eugene Toder added the comment:
It appears that
* co_name was added to hash and cmp in this check-in by Guido:
http://hg.python.org/cpython-fullhistory/diff/525b2358721e/Python/compile.c
I think the reason was to preserve function name when defining multiple
functions with the same code in
Eugene Toder added the comment:
I would propose changing implementation to match the comment. At a minimum,
remove co_firstlineno comparison. As the last resort, at least change the
comment.
--
___
Python tracker
<http://bugs.python.
New submission from Eugene Toder :
A comment in the definition of PyCodeObject in Include/code.h says:
/* The rest doesn't count for hash or comparisons */
which, I think, makes a lot of sense. The implementation doesn't follow this
comment, though. code_hash actually includes c
Eugene Toder added the comment:
So in the near term, dis-based tests should continue to copy/paste sys.stdout
redirection code?
--
___
Python tracker
<http://bugs.python.org/issue11
Eugene Toder added the comment:
This patch fixes the problem by moving the check from object_new to
PyType_GenericAlloc. The check is very cheap, so this should not be an issue.
--
keywords: +patch
nosy: +eltoder
Added file: http://bugs.python.org/file21600/abc.patch
Eugene Toder added the comment:
Agreed, but that would require rewriting of all tests in test_peepholer.
--
___
Python tracker
<http://bugs.python.org/issue11
Changes by Eugene Toder :
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/issue11816>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Eugene Toder :
Added file: http://bugs.python.org/file21599/dis.patch
___
Python tracker
<http://bugs.python.org/issue11816>
___
___
Python-bugs-list mailin
Changes by Eugene Toder :
Removed file: http://bugs.python.org/file21598/dis.diff
___
Python tracker
<http://bugs.python.org/issue11816>
___
___
Python-bugs-list mailin
New submission from Eugene Toder :
As discussed in Issue11549 a couple of tests need to inspect disassembly of
some code. Currently they have to override sys.stdout, run dis and restore
stdout back. It would be much nicer if dis module provided functions that
return disassembly as a string
Eugene Toder added the comment:
If we have to preserve backward compatibility of Python AST API, we can do this
relatively easily (at the expense of some code complexity):
* Add 'version' argument to compile() and ast.parse() with default value of 1
(old AST). Value 2 will corresp
Eugene Toder added the comment:
Also, to avoid any confusion -- currently my patch only runs AST optimizations
before code generation, so compile() with ast.PyCF_ONLY_AST returns
non-optimized AST.
--
___
Python tracker
<http://bugs.python.
Eugene Toder added the comment:
> I don't think it can:
That already doesn't work in dict and set (eq not consistent with hash), I
don't think it's a big problem if that stops working in some other cases.
Anyway, I said "theoretically" -- maybe after
Eugene Toder added the comment:
> and with __future__ it should work on 2.5 as well.
Actually, seems that at least str.format is not in 2.5 as well. Still the
question is should I make it run on 2.5 or 2.4 or is 2.6 OK (then __future__
can be remo
Eugene Toder added the comment:
Thanks.
> string concatenation will now work, and errors like "'hello' - 'world'"
> should give a more informative TypeError
Yes, 'x'*5 works too.
> Bikeshed: We use Attribute rather than Attr for that node
Eugene Toder added the comment:
Is anyone looking or planing to look at the patch?
--
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bug
Eugene Toder added the comment:
AFAICT my patch has everything that #1346238 has, except BoolOps, which can be
easily added (there's a TODO). I don't want to add any new code, though, until
the current patch will get reviewed -- adding code will only make reviewing
harder.
#1
Eugene Toder added the comment:
Just for fun I've run pystones. W/o my changes it averages to about 70k, with
my changes to about 72.5k.
--
___
Python tracker
<http://bugs.python.org/is
Eugene Toder added the comment:
I've updated patches on Rietveld with some small changes. This includes better
code generation for boolops used outside of conditions and cleaned up
optimize_jumps(). This is probably the last change before I get some feedback.
Also, I forgot to me
Eugene Toder added the comment:
Any comments on the code so far or suggestions on how we should move forward?
--
___
Python tracker
<http://bugs.python.org/issue11
Eugene Toder added the comment:
I see. Should I attach diffs vs. some revision from hg.python.org?
--
___
Python tracker
<http://bugs.python.org/issue11
Eugene Toder added the comment:
Thanks. Review link: http://codereview.appspot.com/4281051
--
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Pytho
Eugene Toder added the comment:
Because I don't know how to make them. Any pointers?
--
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Pytho
Eugene Toder added the comment:
Is anyone reviewing my patch? It's just 1 line long. Should it be moved to
another issue? Though, technically, it's needed to address the regression in
question: Python 3.1 folds -0, the current code stil
Changes by Eugene Toder :
--
nosy: +pitrou, rhettinger
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Eugene Toder :
Added file: http://bugs.python.org/file21202/0_tests.patch
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bugs-list mailin
Changes by Eugene Toder :
Added file: http://bugs.python.org/file21201/0_generated.patch
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bugs-list m
Changes by Eugene Toder :
Added file: http://bugs.python.org/file21200/0_compile.patch
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bugs-list m
Changes by Eugene Toder :
Added file: http://bugs.python.org/file21199/0_fold.patch
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bugs-list mailin
Changes by Eugene Toder :
--
keywords: +patch
Added file: http://bugs.python.org/file21198/0_ast.patch
___
Python tracker
<http://bugs.python.org/issue11
New submission from Eugene Toder :
As pointed out by Raymond, constant folding should be done on AST rather than
on generated bytecode. Here's a patch to do that. It's rather long, so overview
first.
The patch replaces existing peephole pass with a folding pass on AST and a few
New submission from Eugene Toder :
Since the time 'x in set' optimization was added to peephole it has the
following bug with set unpacking:
>>> def foo(x,y):
a,b = {x,y}
return a,b
>>> dis(foo)
2 0 LOAD_FAST0 (x
Eugene Crosser added the comment:
Steffen: can you please be more specific?
As I read the seciton 8.2 of the cited document, I do not see a disparity with
my statement. There is even an example:
"""
For example, if a user wanted to interact with the system in French, but
r
Eugene Crosser added the comment:
I don't know if the solution suggested in the report is right, but I can
confirm the the current logic of getdefaultlocale() produces wrong results.
I have
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE=ru_RU.UTF-8
LC_COLLATE=ru_RU.UTF-8
which
Eugene Toder added the comment:
Raymond, you can be assured that I'm not developing this patch, unless I'm told
it has chances to be accepted. I don't like to waste my time. On a related
note, your review of my other patches
1 - 100 of 142 matches
Mail list logo