[issue1040026] os.times() is bogus

2008-02-23 Thread Alexander Belopolsky
Changes by Alexander Belopolsky: _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1040026> _ ___ Python-bugs-list mailing list Unsubscribe: http://mai

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Small comment on the patch: def clear(self): -for key in self.data.keys(): +for key in self.keys(): unsetenv(key) -del self.data[key

[issue1367711] Remove usage of UserDict from os.py

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I would say dict's failure to call overloaded __setitem__ from setdefault is a dict implementation problem which should be either fixed, or clearly documented as warning to anyone who wants to derive from dict. A fix would be tr

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > dict doesn't dynamically bind any calls; to > properly replace the semantics of dict, you > have to implement *all* API. What was the rationale for this decision? To me it looks like a hold- over from the time when dicts were not subclass

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: First, if the new thread on dict behavior does not make sense, please see discussion at issue1367711 where it started. (My mistake following up here.) Second, the ability to subclass built-in type is such a great feature, that it is a shame that doing

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > The builtins make direct calls to their own internal methods. Raymond, I guess issue2067 escaped your review. :-) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.o

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Let's get back on-topic. I assume you are recommending to close this issue by rejecting the patch. I disagree. The patch can be fixed to properly override all methods and a unit test can be added to guarantee that all dict methods are overr

[issue1367711] Remove usage of UserDict from os.py

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: See comments at issue2144. Benjamin Peterson demonstrated a more than 2x speedup on a micro-benchmark. Plus, the fact that two people were motivated enough to independently produce a near-complete patch is worth something

[issue1040026] os.times() is bogus

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > 1. .. It's preferable to cast into a clock_t immediately rather than > doing a conversion for each of the ensuing divisions. If that's your motivation, then you should cast to double instead. However, I would leave it to comp

[issue1040026] os.times() is bogus

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Aha, I should read my own sources: "The value shall not change during the lifetime of the calling process, [XSI] except that sysconf(_SC_OPEN_MAX) may return different values before and after a call to setrlimit() which changes the RLIMIT_NOFILE

[issue1040026] os.times() is bogus

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: FWIW, the following minimal patch fixed the bug on MacOS X and does not affect Linux: === --- Modules/posixmodule.c (revision 61014) +++ Modules/posixmodule.c (working copy

[issue2144] os.environ should inherit dict

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Did anyone mention "clutch"? :-) Oh, well, please close issue1367711 as a duplicate. __ Tracker <[EMAIL PROTECTED]> <http://bugs.p

[issue2172] Add doc-string to UserDict and DictMixin

2008-02-23 Thread Alexander Belopolsky
New submission from Alexander Belopolsky: Attached patch improves pydoc UserDict presentation. One of the problems with the current documentation in comments is that order of methods is not preserved and thus the method level comments in DictMixin implementation are meaningless in pydoc. (In

[issue2172] Add doc-string to UserDict and DictMixin

2008-02-23 Thread Alexander Belopolsky
Changes by Alexander Belopolsky: Added file: http://bugs.python.org/file9530/UserDict-doc.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2172> __ ___ Pyth

[issue2172] Add doc-string to UserDict and DictMixin

2008-02-23 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Fixed an error in lavels doc. Needs review. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2172> __ ___ Python-bugs-list

[issue2172] Add doc-string to UserDict and DictMixin

2008-02-23 Thread Alexander Belopolsky
Changes by Alexander Belopolsky: -- components: +Documentation versions: +Python 2.6 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2172> __ ___ Pyth

[issue1040026] os.times() is bogus

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Here is my take (posixmodule.diff). When ticks per seconds cannot be determined, python should not provide times rather than refuse to build. Initialization moved to the init function. -- keywords: +patch Added file: http://bugs.python.org

[issue1040026] os.times() is bogus

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > I'd prefer a noisy compile error .. That would be fine if you could verify that none of the currently supported platforms will be affected. I would still feel uneasy about refusing to build python simply because os.times is not ported to a

[issue1040026] os.times() is bogus

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > You complained in msg62869 about the original patch that calling sysconf > on every call leads to an unacceptable slowdown. Your one-line patch > calls sysconf five times on each call when HZ is not defined. That's why I said that w

[issue1040026] os.times() is bogus

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > HZ may be defined on your machine, but it isn't on my (Xeon) machine. Are you sure? Please note that HZ will not show up in grep -w HZ /usr/include because the right header file further up the tree. On Solaris: /usr/include/sys/param.h

[issue1040026] os.times() is bogus

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Thanks Cristian for your intervention. This bug is clearly an aberration: how many GvR reported bugs do you know that stayed open for 3+ years? I think posixmodule.diff satisfies all your requirements and was not opposed by anyone except yours truly

[issue1533] Bug in range() function for large values

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: This is related to issue1540617 and issue1546078. issue1540617 contains a simple patch that extend acceptable range of argument to +/-2**63 issue1546078 contains a complete long integer support implementation and was accepted in Py3k. It looks like

[issue1540617] Use Py_ssize_t for rangeobject members

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > enumerate() and itertools.count() both > show how to support arbitrary longs without > killing the performance of common cases. Unlike enumerate() and count(), range object has 3 integer members: start, step and len. Doubling all of them as

[issue1533] Bug in range() function for large values

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Christian, I was probably a bit sloppy using "range" instead of "xrange," but issue1540617 is limited to xrange only. Are you still -10 on extending xrange on 64-bit platforms to +/- 2**63? If so, what is your position on backport

[issue1533] Bug in range() function for large values

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > So far the memory for the ints is *never* returned > to the system. I'm working on the problem. Christian, Are you working on the memory problem or on this issue? I think I have a solution to OP's problem, but don't want to

[issue1533] Bug in range() function for large values

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Attached patch addresses OP's issue: $ ./python.exe bad_range.py [8, 9, 10, 11, 12, 13, 14, 15, 16, 17] here [18446744073709551616L, 18446744073709551617L, 18446744073709551618L, 18446744073709551619L, 18446744073709551620L, 1844674407370955

[issue1394] simple patch, improving unreachable bytecode removing

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am not sure what this patch would accomplish. I tried $ cat t.py def f(): return 1 1+2 from dis import dis print dis(f) Both with and without patch I get $ ./python.exe -O t.py 2 0 LOAD_CONST 1 (1) 3

[issue1772673] Replacing char* with const char*

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Douglas Greiman submitted many similar changes with his issue2135 patch. His patch also amends documentation, which is missing here. I am adding dgreiman to the nosy list here to avoid duplication of effort. I am -0 on the idea. -- nosy

[issue1766304] improve xrange.__contains__

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > Do we really need another way to spell a <= x < b? Have you got a > real-world use case in mind for the version with step > 1? > I'm at most lukewarm; I'd be willing to look at a patch to the C code > in the py3k-struni

[issue2186] map and filter shouldn't support None as first argument (in Py3k only)

2008-02-24 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: In the absence of an identity function, map accepting None is useful in the cases like this: converters = {..} y = map(converters.get(c), x) That will now have to be rewritten as conv = converters.get(c) if conv is None: y = list(x) else: y = map

[issue1540617] Use Py_ssize_t for rangeobject members

2008-02-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > What specific event triggered your working on this? That was a long time ago, but IIRC, we had some code dealing with large files that grew up beyond 2G. The files contained fixed-length records and we used xrange to iterate over record offsets.

[issue2186] map and filter shouldn't support None as first argument (in Py3k only)

2008-02-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Attached patch removes support for None from filter and itertools.ifilter. My objections for removing that from map do not apply because bool function can be used instead of None in filter achieving similar performance and better clarity. None support

[issue2187] map and filter objects shouldn't call themselves itertools.imap and itertools.ifilter objects

2008-02-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Can you assign this to Raymond as well? If this is done first, issue2186 patch will be simpler (at least in the documentation portion). The same question on the fate of ifilterfalse is pertinent here as well. -- nosy: +belopolsky

[issue1394] simple patch, improving unreachable bytecode removing

2008-02-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I figured that out: >>> def g(): ... raise RuntimeError ... Before the patch: >>> dis(g) 2 0 LOAD_GLOBAL 0 (RuntimeError) 3 RAISE_VARARGS1 6 LOAD_CONST

[issue2186] map and filter shouldn't support None as first argument (in Py3k only)

2008-02-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Raymond, There must be a reason why we constantly disagree. Do you live in California by any chance? :-) I am not sure if map(None, ..) fate is still up for voting given your changes at r60206, but your own patch illustrates the problem that I

[issue2186] map and filter shouldn't support None as first argument (in Py3k only)

2008-02-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Raymond, it looks like you just broke the build for me: /Users/sasha/Work/python-svn/trunk/Modules/itertoolsmodule.c: In function 'ifilter_next': /Users/sasha/Work/python-svn/trunk/Modules/itertoolsmodule.c:2058: error: invalid operands

[issue1394] simple patch, improving unreachable bytecode removing

2008-02-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Attached patch adds test_elim_unreachable() unit test. Last two assertions should fail with unpatched python. I am still trying to convince myself that the transformation are correct. > I propose that codestr[] array is made one byte > long

[issue1394] simple patch, improving unreachable bytecode removing

2008-02-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Paul, You are right. I misunderstood that comment myself. I've tried the attached modification to your patch (unreachable-code-1.diff) and it passes all tests while fixing msg62953 problem: $ cat t.py def f(): return 1 1+2 from dis i

[issue2186] map and filter shouldn't support None as first argument (in Py3k only)

2008-02-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > What do you guys think about just making the predicate argument > optional? You've read my mind! That what I was going to suggest if I realized that optional argument does not have to be the last one. Looks like it would make se

[issue2186] map and filter shouldn't support None as first argument (in Py3k only)

2008-02-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > I think the motivation behind your other use case will likey be > addressed in a more general way with an identify function being > added to the operator module. Quite true, but I thought operator.identity was dead and buried. Can y

[issue1394] simple patch, improving unreachable bytecode removing

2008-02-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I have added more tests as Neal suggested. See unreachable-code-with- tests.diff for a combined patch. I've rerun all tests after removing .pyc files and also with -O option (ensuring no existing .pyo files as well). All works. I've rem

[issue1673203] add identity function

2008-02-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Raymond Hettinger wrote in msg63027 (issue2186): """ .. it looks like there [is an] agreement on dropping None for map() and going forward with the operator.identity() patch. Will check these in in the next couple of days. "&quo

[issue1394] simple patch, improving unreachable bytecode removing

2008-02-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > Since you don't increment codelen .. Good catch! > For this reason, if() before > writing the RETURN_VALUE is not needed. In this case it will be clearer to use STOP_CODE instead of RETURN_VALUE

[issue2197] Further simplify dict literal bytecode

2008-02-26 Thread Alexander Belopolsky
New submission from Alexander Belopolsky: I am attaching a proof-of-concept patch that changes the bytecode generated from {1:1,2:2,3:3,4:4} from BUILD_MAP4 LOAD_CONST 2 (1) LOAD_CONST 2 (1) STORE_MAP LOAD_CONST 1 (2

[issue2197] Further simplify dict literal bytecode

2008-02-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Hmm, it looks like this was considered before (issue402227), but back then there were no set literals. If stack-saving approach is better for dicts, it should be better for sets as well. In any case, maybe it is time to revisit the issue and decide on

[issue2197] Further simplify dict literal bytecode

2008-02-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I did not think of the insertion after creation change of semantics. Do I understand that this is important when keys have custom comparison/hash methods with side-effects. If it is important for the language to guarantee the create/insert order in

[issue2183] optimize list comprehensions

2008-02-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The patch looks reasonable to me. Bytecode docs need to be changed. At minimum like this: === --- Doc/library/dis.rst (revision 61097) +++ Doc/library/dis.rst (working copy) @@ -463,9 +463,9

[issue2185] code objects should conserve memory

2008-02-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Since names and varnames are known to be tuples of interned strings, they can be compared without calling abstract API. Just compare sizes and then compare item pointers in a loop. What are the cases when co_names == co_varnames? How often is this the

[issue1766304] improve xrange.__contains__

2008-02-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Here are my comments on the py3k patch: 1. Sign of a PyLong object o is the same as the sign of Py_SIZE(o). I would think it is safe to use this fact within python core. (User code that may need to work across multiple versions of python may need to

[issue2222] Memory leak in os.rename?

2008-03-03 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: It looks like non-windows code has a similar problem: static PyObject * posix_2str(PyObject *args, char *format, int (*func)(const char *, const char *)) { char *path1 = NULL, *path2 = NULL; int res; if

[issue2179] with should be as fast as try/finally

2008-03-03 Thread Alexander Belopolsky
Changes by Alexander Belopolsky: -- nosy: +belopolsky __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2179> __ ___ Python-bugs-list mailing list Unsubs

[issue2223] regrtest.py -R not working

2008-03-03 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: It looks like you are running regrtest from the trunk with the py3k interpretor. Works for me. -- nosy: +belopolsky __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/

[issue2223] regrtest.py -R not working

2008-03-03 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: attached simple patch seems to fix the problem but should be reviewed by Christian. -- keywords: +patch Added file: http://bugs.python.org/file9596/regrtest.patch __ Tracker <[EMAIL PROTECTED]>

[issue2223] regrtest.py -R not working

2008-03-03 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > Can you test it on your machine please? Running on a 4-core Opteron (2.6GHz). Should complete in an hour or so ... __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.o

[issue2223] regrtest.py -R not working

2008-03-03 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: test_collections fails (with -R :: only). Does not look like something related to the recent changes, rather test is not happy about being repeated. $ ./python Lib/test/regrtest.py -R :: test_collections test_collections beginning 9 repetitions

[issue2198] code_hash() can be the same for different code objects

2008-03-03 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I would say filename/lineno are excluded from hash on purpose because they are ignored in comparisons: >>> compile("0", "a", "eval") == compile("0", "b", "eval") True Include/code.h

[issue2223] regrtest.py -R not working

2008-03-03 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Here are the results from regrtest.py -R :: .. 301 tests OK. 7 tests failed: test_collections test_cprofile test_frozen test_inspect test_logging test_pkg test_profile .. $ cat reflog.txt test_cmd_line leaked [-23, 0, 0, 23] references, sum=0

[issue2230] Document PyArg_Parse* behavior on failed conversion

2008-03-03 Thread Alexander Belopolsky
New submission from Alexander Belopolsky: Much of existing code relies on PyArg_Parse* leaving C variables unmodified when conversion failed. Attached patch documents that behavior. -- files: doc-arg.diff keywords: patch messages: 63243 nosy: belopolsky severity: normal status: open

[issue2230] Document PyArg_Parse* behavior on failed conversion

2008-03-03 Thread Alexander Belopolsky
Changes by Alexander Belopolsky: -- components: +Documentation severity: normal -> minor type: -> feature request versions: +Python 2.3, Python 2.4, Python 2.5, Python 2.6, Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue2222] Memory leak in os.rename?

2008-03-04 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The affected code is the only case I could find in stdlib where O& format was used to populate PyObject* variables. Although it appears to be valid usage, the code presents an exception to the following note at http://docs.python.org/dev/c-api/arg.

[issue2231] Memory leak in itertools.chain()

2008-03-04 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Good catch, Hirokazu! The patch looks correct to me. Works as advertised on Mac OS 10.4. -- nosy: +belopolsky __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/

[issue2222] Memory leak in os.rename?

2008-03-04 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On the test_os patch: I would rename LeakTest to ErrorTest and leave it on for all platforms. BTW, I cannot produce a definitive proof that posix_2str leaks when second conversion fails (regrtest -R does not catch it because the leaked buffer is not a

[issue2239] Tiny patch to cmdline docs

2008-03-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: PYTHONPATH variable is likely to be defined by sysadmins who may not know what os.pathsep is. Maybe it is better to say "OS-dependent separator (';' on Windows, ':' on Linux and other UNIX-like OSes or ',' on some les

[issue2239] Tiny patch to cmdline docs

2008-03-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > .. but I have made the doc reference a link to the os.pathsep I knew you would say that :-). I was making my comment out of real life experience: sysadmins rarely know python language, but can do good job administering python installations.

[issue2239] Tiny patch to cmdline docs

2008-03-05 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > Feel free to propose an alternative wording for the patch I thought I already did in my first post. The complete sentence should read: """ The format is the same as the shell's :envvar:`PATH`: one or more directory pathn

[issue2246] itertools.groupby() leaks memory with circular reference

2008-03-06 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: With the following patch: === --- Lib/test/test_itertools.py (revision 61284) +++ Lib/test/test_itertools.py (working copy) @@ -707,6 +707,12 @@ a = [] self.makecycle

[issue2246] itertools.groupby() leaks memory with circular reference

2008-03-06 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: It looks like the problem is that the internal grouper object becomes a part of a cycle: keyfunc -> grouper(x) -> keyfunc(tgtkey), but its type does not support GC. I will try to come up with a patch. __ Tracker &

[issue2246] itertools.groupby() leaks memory with circular reference

2008-03-06 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Oops. Here is my patch anyways. -- keywords: +patch Added file: http://bugs.python.org/file9625/groupby-leak.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/

[issue1533486] long -> Py_ssize_t (C/API 1.2.1)

2008-03-06 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I think it should be changed to "because sizeof(Py_ssize_t) == sizeof(void*)" -- nosy: +belopolsky _ Tracker <[EMAIL PROTECTED]> <http://bugs.pyth

[issue2222] Memory leak in os.rename?

2008-03-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Aha! I did not know about the cleanup. Maybe that should be documented as well. This shows that using O& with a converter returning a PyObject* is a bad idea. (General clean-up is not possible for O& because there is no way to tell what

[issue1950] Potential overflows due to incorrect usage of PyUnicode_AsString.

2008-03-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Your description of the patch is a bit misleading. As far as I can tell only the first chunk (Python/import.c changes) addresses a potential buffer overflow. For example the last chunk (Modules/posixmodule.c changes) simply eliminates an unused variable

[issue1950] Potential overflows due to incorrect usage of PyUnicode_AsString.

2008-03-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I tried to produce a buffer overflow in get_parent (import.c), but an attempt to import a module with non-ascii characters is aborted in getargs.c before get_parent is reached: >>> __import__("\u0080xyz") Traceback (most recent call las

[issue1950] Potential overflows due to incorrect usage of PyUnicode_AsString.

2008-03-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Here are my comments on the other parts of the patch: Python/structmember.c The existing code is safe, but would silently produce wrong result if T_CHAR attribute is assigned a non-ascii character. With the patch this situation will be detected and an

[issue1733184] slice type is unhashable

2008-03-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Patch # 408326 was designed to make assignment to d[:] an error where d is a dictionary. See discussion starting at http://mail.python.org/pipermail/python-list/2001-March/072078.html . I think the only reason slice objects need to be comparable is

[issue1617161] Instance methods compare equal when their self's are equal

2008-03-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > the change was meant to unify > the behavior of built-in and > user method objects I don't think it achieved that. Consider: >>> [].index == [].index False but >>> UserList().index == UserList().index Tr

[issue1741218] string formatter %x problem with indirectly given long

2008-03-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: This issue has been resolved in issue1742669 . $ ./python.exe Python 2.6a1+ (trunk:61230M, Mar 4 2008, 10:56:31) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license

[issue1733184] slice type is unhashable

2008-03-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: In case I did not make my position clear in my previous post, I am -1 on this RFE. x[:] should mean slicing, not getitem. _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/iss

[issue1733184] slice type is unhashable

2008-03-08 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Note that L[:] and L[:] = [] are well-known idioms for making a copy of a list and emptying the list respectively. (For dictionaries we have D.copy() and D.clear().) Someone looking at x[:] or x[:] = [] should immediately recognize a list copy or clear

[issue1533486] long -> Py_ssize_t (C/API 1.2.1)

2008-03-08 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Georg, did you miss the s/assuming/because/ part of my proposal? Python guarantees that sizeof(Py_ssize_t) == sizeof(size_t) == sizeof(void*). (See PEP 353.) "Assuming" is therefore misleading because it suggests that it may not be a

[issue1617161] Instance methods compare equal when their self's are equal

2008-03-09 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: Armin, I think this should be discussed on python-dev. I don't understand your motivation for comparing methods of distinct but equal objects as equal. The callback argument on the other hand, is

[issue2249] To document "assertTrue" in unittest

2008-03-09 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: FWIW, grepping through Lib/test reveals the following statistics: assertFalse: 83 assertTrue: 97 failUnless: 684 assert_: 1977 Not having assertTrue/assertFalse methods in the Library Reference does not discourage people from

[issue2249] To document "assertTrue" in unittest

2008-03-09 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: Just to make the story complete, it should be mentioned that assertFalse/True were added because these are the names used by JUnit: r34209 | purcell | 2003

[issue2268] Fold slice constants

2008-03-10 Thread Alexander Belopolsky
New submission from Alexander Belopolsky <[EMAIL PROTECTED]>: I am attaching a proof-of-concept patch which would optimize bytecode generated from constant slices as follows: Before patch: >>> dis(lambda:x[1:2:3]) 1 0 LOAD_GLOBAL 0 (x)

[issue2267] datetime.datetime operator methods are not subclass-friendly

2008-03-10 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: This is trivial to implement (see attached) and IMHO is a good idea. The next question, however is whether similar changes should be made to timedelta arithmetics. Timedelta case is not so clearcut because of the usual dile

[issue2267] datetime.datetime operator methods are not subclass-friendly

2008-03-10 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: Invoking a subclass's constructor is only an issue when subclass adds data members. In this case, arithmetic methods need to be overridden. Note that my patch does not make __add__ and friends invoke subclass' c

[issue2186] map and filter shouldn't support None as first argument (in Py3k only)

2008-03-12 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: It may be too late to express my opinion, but why symmetry with map is so important? There are several reasons why sequence, predicate order is natural for filter and function, sequence is a natural order for map. 1. I

[issue2291] Catching all exceptions with 'object'

2008-03-14 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: Py3k behavior seems to be better: Python 3.0a2+ (py3k:61137M, Feb 29 2008, 15:17:29) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin >>> try: ... raise ValueError("foo") ... except object: ...

[issue2292] Missing *-unpacking generalizations

2008-03-15 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: This was discussed years ago and never got enough support: http://mail.python.org/pipermail/python-dev/2005-October/057177.html -- nosy: +belopolsky type: -> feature request __ Tracke

[issue2292] Missing *-unpacking generalizations

2008-03-15 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: It looks like I completely missed PEP 3132. Sorry for a misleading comment above. At least I am not alone: "A little new feature in Python 3 that many overviews don't tell you about: extended unpacking." http:

[issue2298] Patch for "string without null bytes" check in getargs.c

2008-03-16 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: Note that this patch will expose a bug fixed in issue1950. (See msg63363.) I suggest that the import.c part of issue1950 and this go together. Alexandre? -- nosy: +alexandre.vassalotti, belo

[issue2291] Catching all exceptions with 'object'

2008-03-16 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: I thought some more about this issue and the current behavior seems wrong and potentially dangerous. Consider the following code: class x: pass class y(x): pass try: raise y except y: print "

[issue2289] os.path.normpath over-normalizes

2008-03-16 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: This is a documented feature: """ normpath(path) Normalize a pathname. ... It should be understood that this may change the meaning of the path if it contains symbolic links! """ See http://doc

[issue448736] pydoc needs readline completion

2008-03-17 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: This was duplicated in issue726204 and fixed in r37026. -- nosy: +belopolsky Tracker <[EMAIL PROTECTED]> <http://bugs.python.

[issue416670] MatchObjects not deepcopy()able

2008-03-17 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: A related issue419070 was closed with no resolution (or resolution did not survive the trip from SF), but it looks like the patch was rejected. Some work towards this issue was done in r21437, but 7 years later it is still mar

[issue433027] SRE: (?-flag) is not supported.

2008-03-17 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: This depends on issue433024 (SRE: (?flag) isn't properly scoped.) -- nosy: +belopolsky Tracker <[EMAIL PROTECTED]> <http://bugs.py

[issue433024] SRE: (?flag) isn't properly scoped

2008-03-17 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: This is still a valid issue. (As of Python 2.6a1+ (trunk:61434, Mar 17 2008, 08:06:54).) >>> bool(re.match("abc(?i)","AbC")) True The documentation says that the behavior of a regex with (?) not at

[issue868845] Need unit tests for <...> reprs

2008-03-17 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: If any work needs to be done on this issue, it should probably be labeled "easy." (At least the writing the unit tests part. Making <...> reprs consistent is another story.) The unit tests for old-style and

[issue2298] Patch for "string without null bytes" check in getargs.c

2008-03-17 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: On Mon, Mar 17, 2008 at 9:51 AM, Alexandre Vassalotti < [EMAIL PROTECTED]> wrote: > > Alexandre Vassalotti <[EMAIL PROTECTED]> added the comment: > > .. Although I haven't reviewed this > pat

[issue868845] Need unit tests for <...> reprs

2008-03-17 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: I think the attached patch captures the most of what can currently be said about <...> reprs. I think the biggest offender in terms of inconsistency in the 2.x series is the file object with the repr which does not eve

[issue2298] Patch for "string without null bytes" check in getargs.c

2008-03-17 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: There is now issue2322 (Clean up getargs.c and its formatting possibilities) related to this. __ Tracker <[EMAIL PROTECTED]> <http://bugs.pytho

<    9   10   11   12   13   14   15   16   17   18   >