[issue44018] Bug in random.seed

2021-05-03 Thread Eugene Rossokha
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) >

[issue44018] Bug in random.seed

2021-05-03 Thread Eugene Rossokha
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

[issue42903] optimize lru_cache for functions with no arguments

2021-01-12 Thread Eugene Toder
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

[issue42903] optimize lru_cache for functions with no arguments

2021-01-11 Thread Eugene Toder
Eugene Toder added the comment: Ammar, thank you for the link. -- ___ Python tracker <https://bugs.python.org/issue42903> ___ ___ Python-bugs-list mailin

[issue42903] optimize lru_cache for functions with no arguments

2021-01-11 Thread Eugene Toder
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. Also

[issue42903] optimize lru_cache for functions with no arguments

2021-01-11 Thread Eugene Toder
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 even

[issue42125] linecache cannot get source for the __main__ module with a custom loader

2020-12-18 Thread Eugene Toder
Change by Eugene Toder : -- nosy: +ncoghlan, vstinner ___ Python tracker <https://bugs.python.org/issue42125> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42125] linecache cannot get source for the __main__ module with a custom loader

2020-12-15 Thread Eugene Toder
Change by Eugene Toder : -- nosy: +brett.cannon ___ Python tracker <https://bugs.python.org/issue42125> ___ ___ Python-bugs-list mailing list Unsubscribe:

[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

[issue42125] linecache cannot get source for the __main__ module with a custom loader

2020-10-22 Thread Eugene Toder
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

[issue40962] Add documentation for asyncio._set_running_loop()

2020-06-12 Thread Eugene Huang
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 function

Why is augmented assignment of a tuple with iterable unpacking invalid syntax?

2019-05-19 Thread Eugene Alterman
a = 1, 2, 3 b = *a, # assignment - OK b += *a, # augmented assignment - syntax error Need to enclose in parenthesis: b += (*a,) Why isn't it allowed with an augmented assignment, while it is OK with a regular assignment? --

[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

[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

[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 interpreted

[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 > is

[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 classes. @r.david.murray

[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 done

[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

[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

[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

[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 <rep...@bugs.python.org> <http://bugs.python.org/issue11549> ___ ___ Pyth

[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 <

[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 >>

[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) files: te

[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

[issue24991] Define instance mutability explicitly on type objects

2015-09-03 Thread Eugene Toder
Changes by Eugene Toder <elto...@gmail.com>: -- nosy: +eltoder ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24991> ___ __

[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 module

[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

[issue24978] Contributing to Python 2x and 3x Documentation. Translation to Russian.

2015-09-01 Thread Eugene
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

[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

[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 rep...@bugs.python.org 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 numbers

[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 from

[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 rep...@bugs.python.org

[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 rep...@bugs.python.org http://bugs.python.org/issue23726

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

2015-03-21 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: Added file: http://bugs.python.org/file38624/class_gc2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23726

[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. -- files

[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__ = Tuple () Imma tuple

[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 rep

[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! os.path.join(C:, filename) 'C:filename' But I expect two

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

2015-02-27 Thread Eugene Bright
Changes by Eugene Bright hex...@gmail.com: -- type: - behavior versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23535

[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 rep...@bugs.python.org http://bugs.python.org/issue23535

Re: Regex substitution trouble

2014-11-05 Thread Eugene
massi_...@msn.com wrote: Hi everyone, I'm not really sure if this is the right place to ask about regular expressions, but since I'm usin python I thought I could give a try :-) Here is the problem, I'm trying to write a regex in order to substitute all the occurences in the form

[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 again, this does seem to be a very specific corner case. -- nosy

Development infrastructure - need python packaging gurus help, please

2014-01-28 Thread Eugene Sajine
the disclaimer that it s not working ok sometimes) wheel is pretty much unusable for anything other then installing into the virtualenv. Am i missing something? Thanks in advance, Eugene -- https://mail.python.org/mailman/listinfo/python-list

[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 rep...@bugs.python.org http

[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_firstlineno

[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

[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=None

[issue1062277] Pickle breakage with reduction of recursive structures

2012-12-28 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: -- versions: +Python 3.3, Python 3.4 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1062277

[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_OBJECT(p

[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 nicer than

[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 rep...@bugs.python.org http://bugs.python.org/issue16602

[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 hanging. Tested

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

2012-09-05 Thread Eugene Toder
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] where the tuple is constant

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

2012-09-05 Thread Eugene Toder
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) assigned

[issue1065427] sre_parse group limit check missing with 'python -O'

2012-08-20 Thread Eugene Voytitsky
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 read here

[issue11816] Refactor the dis module to provide better building blocks for bytecode analysis

2011-08-23 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: -- nosy: -eltoder ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11816 ___ ___ Python-bugs-list mailing

[issue5996] abstract class instantiable when subclassing dict

2011-07-11 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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

[issue12290] __setstate__ is called for false values

2011-06-15 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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 rep...@bugs.python.org http

[issue5996] abstract class instantiable when subclassing dict

2011-06-15 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: Anyone has any thoughts on this? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5996

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

2011-06-15 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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

[issue12290] __setstate__ is called for false values

2011-06-08 Thread Eugene Toder
New submission from Eugene Toder elto...@gmail.com: 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 protocol. A small example

[issue12290] __setstate__ is called for false values

2011-06-08 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: -- nosy: +alexandre.vassalotti, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12290

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

2011-06-07 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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

[issue11983] Inconsistent hash and comparison for code objects

2011-05-08 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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

[issue11983] Inconsistent hash and comparison for code objects

2011-05-08 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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 rep

[issue11983] Inconsistent hash and comparison for code objects

2011-05-06 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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 rep

[issue11983] Inconsistent hash and comparison for code objects

2011-05-02 Thread Eugene Toder
New submission from Eugene Toder elto...@gmail.com: 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

[issue11816] Refactor the dis module to provide better building blocks for bytecode analysis

2011-04-10 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: So in the near term, dis-based tests should continue to copy/paste sys.stdout redirection code? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11816

[issue11816] Add functions to return disassembly as string

2011-04-09 Thread Eugene Toder
New submission from Eugene Toder elto...@gmail.com: 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

[issue11816] Add functions to return disassembly as string

2011-04-09 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: Removed file: http://bugs.python.org/file21598/dis.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11816

[issue11816] Add functions to return disassembly as string

2011-04-09 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: Added file: http://bugs.python.org/file21599/dis.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11816

[issue11816] Add functions to return disassembly as string

2011-04-09 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11816 ___ ___ Python-bugs-list mailing

[issue11816] Add functions to return disassembly as string

2011-04-09 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: Agreed, but that would require rewriting of all tests in test_peepholer. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11816

[issue5996] abstract class instantiable when subclassing dict

2011-04-09 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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

[issue11549] Rewrite peephole to work on AST

2011-03-28 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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

[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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 type, perhaps the full Literal name would

[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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 removed

[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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 some conservative type

[issue11549] Rewrite peephole to work on AST

2011-03-27 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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 rep

[issue11549] Rewrite peephole to work on AST

2011-03-23 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: Is anyone looking or planing to look at the patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11549] Rewrite peephole to work on AST

2011-03-19 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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

[issue11549] Rewrite peephole to work on AST

2011-03-16 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: Any comments on the code so far or suggestions on how we should move forward? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11549] Rewrite peephole to work on AST

2011-03-16 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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

[issue11549] Rewrite peephole to work on AST

2011-03-16 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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 rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11244] Negative tuple elements produce inefficient code.

2011-03-15 Thread Eugene Toder
Eugene Toder elto...@gmail.com 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 still does

[issue11549] Rewrite peephole to work on AST

2011-03-15 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: Because I don't know how to make them. Any pointers? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11549] Rewrite peephole to work on AST

2011-03-15 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: Thanks. Review link: http://codereview.appspot.com/4281051 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11549] Rewrite peephole to work on AST

2011-03-15 Thread Eugene Toder
Eugene Toder elto...@gmail.com added the comment: I see. Should I attach diffs vs. some revision from hg.python.org? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11510] Peephole breaks set unpacking

2011-03-14 Thread Eugene Toder
New submission from Eugene Toder elto...@gmail.com: 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) 3

[issue11549] Rewrite peephole to work on AST

2011-03-14 Thread Eugene Toder
New submission from Eugene Toder elto...@gmail.com: 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

[issue11549] Rewrite peephole to work on AST

2011-03-14 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file21198/0_ast.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11549] Rewrite peephole to work on AST

2011-03-14 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: Added file: http://bugs.python.org/file21199/0_fold.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11549] Rewrite peephole to work on AST

2011-03-14 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: Added file: http://bugs.python.org/file21200/0_compile.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11549] Rewrite peephole to work on AST

2011-03-14 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: Added file: http://bugs.python.org/file21201/0_generated.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11549] Rewrite peephole to work on AST

2011-03-14 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: Added file: http://bugs.python.org/file21202/0_tests.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549

[issue11549] Rewrite peephole to work on AST

2011-03-14 Thread Eugene Toder
Changes by Eugene Toder elto...@gmail.com: -- nosy: +pitrou, rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11549 ___ ___ Python-bugs

[issue6981] locale.getdefaultlocale() envvars default code and documentation mismatch

2011-03-12 Thread Eugene Crosser
Eugene Crosser cros...@average.org 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

  1   2   >