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 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,
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
Changes by Eugene Toder :
--
nosy: +alexandre.vassalotti, pitrou
___
Python tracker
<http://bugs.python.org/issue12290>
___
___
Python-bugs-list mailing list
Unsub
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
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:
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:
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
Changes by Eugene Toder :
--
nosy: -eltoder
___
Python tracker
<http://bugs.python.org/issue11816>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eugene Kapun added the comment:
Actually, this can't be fixed without modifying C API methods PyArg_ParseTuple
and PyArg_ParseTupleAndKeywords, because it's possible to make an object
deallocated before PyArg_ParseTuple returns, so Py_INCREF immediately after
parsing would be a
Changes by Eugene Kapun :
Added file: http://bugs.python.org/file19617/test-ctypes.py
___
Python tracker
<http://bugs.python.org/issue6083>
___
___
Python-bugs-list mailin
Changes by Eugene Kapun :
Added file: http://bugs.python.org/file19618/test-functools.py
___
Python tracker
<http://bugs.python.org/issue6083>
___
___
Python-bugs-list m
Eugene Toder added the comment:
As discussed on the list, peephole refuses to fold -0. The reasons for this are
unclear. Folding was disabled with this commit:
http://hg.python.org/cpython/diff/660419bdb4ae/Python/compile.c
Here's a trivial patch to enable the folding again, along with a
New submission from Eugene Toder :
Peephole optimizer performs constant folding, however
1) When it replaces operation with LOAD_CONST it always adds a new constant to
co_consts, even if constant with the same value is already there. It also can
add the same constant multiple times.
2) It does
Changes by Eugene Toder :
--
keywords: +patch
Added file: http://bugs.python.org/file21074/dedup_const_plana.patch
___
Python tracker
<http://bugs.python.org/issue11
Eugene Toder added the comment:
(either plana or planb should be applied)
--
Added file: http://bugs.python.org/file21075/dedup_const_planb.patch
___
Python tracker
<http://bugs.python.org/issue11
Changes by Eugene Toder :
Added file: http://bugs.python.org/file21076/unused_consts.patch
___
Python tracker
<http://bugs.python.org/issue11462>
___
___
Python-bug
Eugene Toder added the comment:
(test case)
--
nosy: +pitrou
Added file: http://bugs.python.org/file21077/consts_test.patch
___
Python tracker
<http://bugs.python.org/issue11
Eugene Toder added the comment:
I think the changes are fairly trivial. dedup_const_planb.patch is about 10
lines of new code with all the rest being trivial plubming. unused_consts.patch
may look big, but only because I factored out fix ups into a separate function;
there are only about 25
Eugene Toder added the comment:
Antoine, sure, I'll fix it with any other suggested changes if patches will be
accepted.
--
___
Python tracker
<http://bugs.python.org/is
Eugene Toder added the comment:
Mark, looks better now?
--
Added file: http://bugs.python.org/file21082/fold-0.patch
___
Python tracker
<http://bugs.python.org/issue11
Changes by Eugene Toder :
Removed file: http://bugs.python.org/file21082/fold-0.patch
___
Python tracker
<http://bugs.python.org/issue11244>
___
___
Python-bugs-list m
Eugene Toder added the comment:
(forgot parens around 0)
--
Added file: http://bugs.python.org/file21083/fold-0.2.patch
___
Python tracker
<http://bugs.python.org/issue11
Eugene Toder added the comment:
> - why the "#ifndef NDEBUG" path?
These entries in the table should not be used, but if something slips through
and uses one of them, it's much easier to tell if we remap to invalid value. As
this is an internal check, I didn't want it i
Eugene Toder added the comment:
assert() doesn't quite work here. I need to check that this entry in the table
is not used in the next loop. I'd need to put assert in that loop, but by that
time I have no easy way to tell which entries are bad, unless I mark them in
the first loop.
Eugene Toder added the comment:
> _PyCode_AddObj() should be added to Include/code.h
Should it be declared as PyAPI_FUNC too? This will make it unnecessarily
exported (when patch in Issue11410 is merged), so I wanted to avoid that.
btw, that you for reviewing the pa
Eugene Toder added the comment:
> Right now, the pattern is tokenize -> parse -> AST -> genbytecode ->
> peephole optimization (which disassembles the bytecode, analyzed it
> and rewrites it) -> final bytecode. The correct pattern is tokenize
> -> parse -&g
New submission from Eugene Toder :
If statement without else part generates unnecessary JUMP_FORWARD insn with
jumps right to the next insn:
>>> def foo(x):
if x: x = 1
>>> dis(foo)
2 0 LOAD_FAST0 (x)
3 POP_JUMP
Eugene Toder added the comment:
Test case (needed some refactoring to avoid duplication).
--
Added file: http://bugs.python.org/file21092/if_no_else_test.patch
___
Python tracker
<http://bugs.python.org/issue11
Eugene Toder added the comment:
Thomas, can you clarify, does loading interns all constants in co_consts, or do
you mean that they are mostly small numbers and the like?
Without interning I think that in-memory size difference is even bigger than
on-disk, as you get one entry in tuple and
Eugene Toder added the comment:
Yes, my patch doesn't fix the regression, only a special case of -0.
--
___
Python tracker
<http://bugs.python.org/is
Eugene Toder added the comment:
Alexander, my patch does 2 optimizations: doesn't insert a new constant if one
already exist and removes unused constants after peephole is done. You patch
seems to do only the latter. It's very similar, from a quick look at your patch:
- My pat
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
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 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
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
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
Changes by Eugene Toder :
--
keywords: +patch
Added file: http://bugs.python.org/file21198/0_ast.patch
___
Python tracker
<http://bugs.python.org/issue11
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 :
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/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/file21202/0_tests.patch
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bugs-list mailin
Changes by Eugene Toder :
--
nosy: +pitrou, rhettinger
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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:
Thanks. Review link: http://codereview.appspot.com/4281051
--
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Pytho
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:
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'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:
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:
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:
Is anyone looking or planing to look at the patch?
--
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bug
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:
> 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:
> 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:
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:
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
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
Changes by Eugene Toder :
Removed file: http://bugs.python.org/file21598/dis.diff
___
Python tracker
<http://bugs.python.org/issue11816>
___
___
Python-bugs-list mailin
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 :
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/issue11816>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eugene Toder added the comment:
Agreed, but that would require rewriting of all tests in test_peepholer.
--
___
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:
So in the near term, dis-based tests should continue to copy/paste sys.stdout
redirection code?
--
___
Python tracker
<http://bugs.python.org/issue11
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:
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.
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:
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
New submission from Eugene Morozov :
There's a peculiar and difficult to find bug in the re.sub method. Try
following example:
>>> text = 'X'*4096
>>> nt = re.sub(u"XX", u".", text, re.U)
>>> nt
u'XXX
New submission from Eugene Baranov :
I tried installing Python 2.6.4 into Program Files in Windows 7 and choose to
compile .py files after install.
Installer correctly asks for a elevation and copies all fixes but it looks like
compile batch are being started from initial, unelevated context
New submission from Eugene Kapun :
>>> a = bytearray()
>>> a[:] = 0 # Is it a feature?
>>> a
bytearray(b'')
>>> a[:] = 10 # If so, why not document it?
>>> a
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
>>> a[:]
Eugene Kapun added the comment:
Empty string is an iterable of integers in the range 0 <= x < 256, so it should
be allowed.
>>> all(isinstance(x, int) and 0 <= x < 256 for x in "")
True
>>> bytearray()[:] = ""
Traceback (most recent ca
New submission from Eugene Kapun :
>>> bytes(10)
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
>>> bytes(10 ** 100)
Traceback (most recent call last):
File "", line 1, in
TypeError: 'int' object is not iterable
--
components: Interpr
Changes by Eugene Kapun :
--
nosy: +abacabadabacaba
___
Python tracker
<http://bugs.python.org/issue1766304>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eugene Kapun added the comment:
> Not really, chars are not ints
Yes, however, empty string contains exactly zero chars.
> and anyway the empty string fall in the first case.
Strings aren't mentioned in documentation of bytearray slice assignment.
However, I think that bytearray
Eugene Kapun added the comment:
__doc__ of bytearray says:
> bytearray(iterable_of_ints) -> bytearray
> bytearray(string, encoding[, errors]) -> bytearray
> bytearray(bytes_or_bytearray) -> mutable copy of bytes_or_bytearray
> bytearray(memory_view) -> bytearray
So, unl
New submission from Eugene Kapun :
I've noticed that set_lookkey (in Objects/setobject.c) does some unsafe things:
Objects/setobject.c:
> if (entry->hash == hash) {
> startkey = entry->key;
> Py_INCREF(startkey);
> cmp = PyObject_RichCompareBo
New submission from Eugene Kapun :
>>> small_set = set(range(2000))
>>> large_set = set(range(2000))
>>> large_set -= small_set # Fast
>>> small_set -= large_set # Slow, should be fast
>>> small_set = small_set - large_set # Fast
--
compo
Eugene Kapun added the comment:
-1 on special-casing string without an encoding. Current code does (almost)
this:
...
if argument_is_a_string:
if not encoding_is_given: # Special case
raise TypeError("string argument without an encoding")
encod
Eugene Kapun added the comment:
I've found more unsafe code in Objects/setobject.c.
This code makes Python 3.1.2 segfault by using a bug in function set_merge:
class bad:
def __eq__(self, other):
if be_bad:
set2.
New submission from Eugene Kapun :
This code shows that frozensets aren't really immutable. The same frozenset is
printed twice, with different content. Buggy functions are set_contains,
set_remove and set_discard, all in Objects/setobject.c
class bad:
def __eq__(self,
Changes by Eugene Kapun :
--
type: -> crash
___
Python tracker
<http://bugs.python.org/issue8420>
___
___
Python-bugs-list mailing list
Unsubscri
New submission from Eugene Kapun :
>>> list().__init__(a=0)
Traceback (most recent call last):
File "", line 1, in
TypeError: 'a' is an invalid keyword argument for this function
>>> set().__init__(a=0)
--
components: Interpreter Core
messages:
Eugene Kapun added the comment:
This patch still assumes that if so->table didn't change then the table wasn't
reallocated (see http://en.wikipedia.org/wiki/ABA_problem). One solution is to
check that so->mask didn't change as well. Also, checking that refcnt > 1
Eugene Kapun added the comment:
> > One solution is to check that so->mask didn't
> > change as well.
>
> I saw that and agree it would make a tighter check, but haven't convinced
> myself that it is necessary.
Without this check, it is possible that th
Eugene Kapun added the comment:
This code crashes python by using another bug in set_repr. This only affects
py3k. This code relies on out-of-memory condition, so run it like:
$ (ulimit -v 65536 && python3 test.py)
Otherwise, it will eat all your free memory before crashing.
val = &qu
Changes by Eugene Kapun :
Added file: http://bugs.python.org/file16981/repr.diff
___
Python tracker
<http://bugs.python.org/issue8420>
___
___
Python-bugs-list mailin
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 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)
>
Change by Eugene Toder :
--
nosy: +brett.cannon
___
Python tracker
<https://bugs.python.org/issue42125>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eugene Toder :
--
nosy: +ncoghlan, vstinner
___
Python tracker
<https://bugs.python.org/issue42125>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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.
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:
@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
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
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
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
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 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
1 - 100 of 142 matches
Mail list logo