[issue12211] math.copysign must keep object type.
umedoblock umedobl...@gmail.com added the comment: abs() behavior show below. type(abs(-1)) class 'int' type(abs(-1.0)) class 'float' we should fix this problem if write Return abs(x) with the sign of y I'd like to try this problem if need fix. I'm going to attach the patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11583] os.path.isdir() is slow on windows
Tim Golden m...@timgolden.me.uk added the comment: Code looks good and tests pass. Only one thing: the code in the patched lib\ntpath.py still refers to FindFirstFile -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12234] unittest2 could enable regex debugging for more information
Domen Kožar ielect...@gmail.com added the comment: I see, currently re module does not support debugging for matching a string. Even the upcoming new regex implementation does not support it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12234 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12224] problem with siginterrupt
Charles-François Natali neolo...@free.fr added the comment: Actually, it's part of a more general problem with EINTR being returned by many posix/socket module functions, see for example issue #7978. On the one hand, having to retry manually on EINTR is cumbersome, on the other hand, some code might rely on this - receiving EINTR - and the posix module policy is to expose syscalls as-is. This should probably be closed as duplicate of issue #9867. -- nosy: +charles-francois.natali ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11104] distutils sdist ignores MANIFEST
Stephen Thorne step...@thorne.id.au added the comment: I've taken the sdist.patch and wrote some tests for it. The resulting patch is attached as 'manifest-respect.patch'. -- nosy: +jerub Added file: http://bugs.python.org/file22242/manifest-respect.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11104 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11104] distutils sdist ignores MANIFEST
Stephen Thorne step...@thorne.id.au added the comment: This patch is tested against the 3.1 and default branches, the previous patch attached was against the 2.7 branch. -- Added file: http://bugs.python.org/file22243/manifest-respect-3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11104 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12224] problem with siginterrupt
STINNER Victor victor.stin...@haypocalc.com added the comment: Victor, I understand your response as saying that there is no bug, which would suggest closing this. Correct? If not, what is the requested action? siginterrupt(False) has no effect on select(). I listed some solutions to not interrupt select() on a signal (avoid completly EINTR). Issues #7978 and #9867 try the other solution, handle EINTR (retry select() on EINTR). I think that most users prefer the later (handle EINTR), so let's close as a duplicate. @Zhiping Deng: Reopen the issue if you want the first solution :-) -- resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12185] Decimal documentation lists first and second arguments, should be self and other
Francisco Martín Brugué franci...@email.de added the comment: Hi Adam, I couldn’t see that from the threat context, I'm new to this and just wanted to learn the work flow and tools so I've just picked up an easy issue to start with. Anyway your patch seems more complete. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12257] Use PYPACKAGING_USE_SDK envvar instead of DISTUTILS_USE_SDK
Martin v. Löwis mar...@v.loewis.de added the comment: I don't think the name should be changed. If anything should be done, we should reconsider whether this flag is actually needed, or whether some other approach to selecting a compiler can be taken. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12257 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12224] problem with siginterrupt
Zhiping Deng kofreesty...@gmail.com added the comment: I think the problem is that after a user calles signal.siginterrupt(False), he would expect that the socket.recv should handles EINTR properly for him because it's the behaviour in c level. He doesn't know socket.recv() calles select(2) internally and he needn't. Or at least this should be documented in signal.siginterrupt(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12224 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12226] use secured channel for uploading packages to pypi
Éric Araujo mer...@netwok.org added the comment: I think there should be a warning that the connection is unauthenticated (i.e. not secure). Users tend to be upset if they see 'https' and later find out that no certificates were verified. Thanks Stephan, that was on my mind but I forgot it. I’m -1 on using https if no validation is performed. I believe that's a very personal judgement. Not really; it’s an explanation of our release rules, exposed by one of the older developers. For me exposing core Python development accounts is a fundamental flaw. What is a core Python development account? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12226 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12246] create installation path if it's non-existent
Éric Araujo mer...@netwok.org added the comment: We do not want to create a directory under $prefix before installation. This would be a sort of dirty half-installation. When you have an uninstalled, unconfigured Python, you cannot install modules without giving a prefix option: this sounds good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12246 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12231] regrtest: add -k and -K options to filter tests by function/file names
Éric Araujo mer...@netwok.org added the comment: File name, class name, method name unless I misremember. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12231 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
Mark Dickinson dicki...@gmail.com added the comment: How about something like: Return a float with the magnitude of x but the sign of y.? The behaviour of math.copysign with respect to non-float inputs matches that of almost all the other math module functions: integer arguments are first converted to floats, and then the underlying libm function applied. I'm not convinced that changing the behaviour of copysign to produce integer results for integer argument would be a good idea. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12257] Rework/replace use of DISTUTILS_USE_SDK in packaging
Éric Araujo mer...@netwok.org added the comment: Agreed. Thanks for the insight. -- title: Use PYPACKAGING_USE_SDK envvar instead of DISTUTILS_USE_SDK - Rework/replace use of DISTUTILS_USE_SDK in packaging ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12257 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12185] Decimal documentation lists first and second arguments, should be self and other
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10935] wsgiref.handlers.BaseHandler and subclasses of str
Éric Araujo mer...@netwok.org added the comment: Here’s my try at making the spec more explicit about str subclasses. -- keywords: +patch Added file: http://bugs.python.org/file22244/pep--no-subclasses.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10935 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11557] Increase coverage in logging module
Éric Araujo mer...@netwok.org added the comment: I saw this commit pass by and noticed a few instances of non-idiomatic unittest code, like unnecessary lambdas or overuse of assertEqual where other methods would give more useful messages in case of failure. Here’s a patch to better it. -- assignee: vinay.sajip - trentm nosy: +eric.araujo, trentm status: closed - open Added file: http://bugs.python.org/file22245/cleanup-test_logging.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11557 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11557] Increase coverage in logging module
Changes by Éric Araujo mer...@netwok.org: -- assignee: trentm - vinay.sajip nosy: -trentm ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11557 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12164] str.translate docstring doesn't mention that 'table' can be None
Mark Dickinson dicki...@gmail.com added the comment: Thanks for the patches! Here's a slight expansion of the wording on your second patch: Return a copy of the string S, where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256 or None. If the table argument is None, no translation is applied and the translation simply removes the characters in deletechars. What do you think? -- assignee: docs@python - mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12164 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12127] Inconsistent leading zero treatment
Mark Dickinson dicki...@gmail.com added the comment: Closing, based on feedback in the comments. Maybe one day... -- resolution: - later status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12245] Document the meaning of FLT_ROUNDS constants for sys.float_info
Mark Dickinson dicki...@gmail.com added the comment: float_info.rounds is a bit of an odd fish, and I think it was probably a mistake to include it in sys.float_info in the first place. All the other float_info fields relate to parameters of the floating-point format, which is fixed, useful information. In contrast, float_info.rounds gives information about the current FPU settings, which are variable. Moreover, it doesn't do that very well: all it does is give information about the FPU settings at the time that Python was compiled, which isn't really very helpful (and perhaps not even that: it reports the value of FLT_ROUNDS, which may not even reflect those FPU settings accurately). I wouldn't mind seeing this field fade quietly into obscurity. FWIW, the value is taken from C's FLT_ROUNDS, and its interpretation is *supposed* to be the following (C99 5.2.4.2.2, para 7): -1: The compiler was unable to determine rounding mode. 0: Round towards zero. 1: Round to nearest (this is the most likely value for float_info.rounds on common platforms). 2: Round towards positive infinity 3: Round towards negative infinity. -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12245 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12248] __dir__ semantics changed in Python 2.7.2
Barry A. Warsaw ba...@python.org added the comment: Using sorted() makes sense to me. Note that I've at least accomplished one goal, which is to have a tracker issue that discusses the merits of the change. That way, no matter what the RM decides, I can at least point to an issue for justification when I resolve the downstream bug. :) Thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12248 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8286] distutils: path '[...]' cannot end with '/' -- need better error message
Éric Araujo mer...@netwok.org added the comment: There is a simple way to fix this: change one line in sdist to catch ValueErrors in addition to DistutilsTemplateError. Users will get a on-line warning message with the ill-formed manifest line number instead of a wall of traceback. This is clearly a bug fix IMO: it is documented that distutils code can raise standard exceptions in addition to Distutils* errors, so here it’s not a new feature but a fix for sdist. (Another way to fix this, would be to catch ValueError raised by convert_path in filelist and wrap it in a DistutilsTemplateError, but I’m not sure it really buys us anything. Maybe it would be the better fix for Packaging, where the Manifest class is intended for public use.) -- assignee: tarek - eric.araujo components: +Distutils2 nosy: +alexis versions: +Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8286 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8286] distutils: path '[...]' cannot end with '/' -- need better error message
Éric Araujo mer...@netwok.org added the comment: a one-line* I’ll have a patch up for review shortly. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8286 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11934] build with --prefix=/dev/null and zlib enabled in Modules/Setup failed
Éric Araujo mer...@netwok.org added the comment: Isn’t zlib built by setup.py anyway? -- nosy: +eric.araujo resolution: invalid - status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11934 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12232] embedded python import cmath
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12232 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12245] Document the meaning of FLT_ROUNDS constants for sys.float_info
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12245 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12245] Document the meaning of FLT_ROUNDS constants for sys.float_info
Changes by Mark Dickinson dicki...@gmail.com: -- assignee: docs@python - mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12245 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12080] decimal.py: performance in _power_exact
Roundup Robot devnull@devnull added the comment: New changeset c3fe54781244 by Mark Dickinson in branch 'default': Issue #12080: Fix a performance issue in Decimal._power_exact that causes some corner-case Decimal.__pow__ calls to take an unreasonably long time. http://hg.python.org/cpython/rev/c3fe54781244 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12080 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12080] decimal.py: performance in _power_exact
Roundup Robot devnull@devnull added the comment: New changeset 78d79499e7de by Mark Dickinson in branch '2.7': Issue #12080: Fix a performance issue in Decimal._power_exact that caused some corner-case Decimal.__pow__ calls to take an unreasonably long time. http://hg.python.org/cpython/rev/78d79499e7de -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12080 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12080] decimal.py: performance in _power_exact
Mark Dickinson dicki...@gmail.com added the comment: Fixed for 3.3 and 2.7. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12080 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12080] decimal.py: performance in _power_exact
Stefan Krah stefan-use...@bytereef.org added the comment: Mark Dickinson rep...@bugs.python.org wrote: Here's a patch. Stefan, could you please review? Mark, sorry for not replying earlier. The patch looks great. I've also tested the patch in practice: I ran 700,000,000 random tests with an exponent range of [-9, 9]. This took three days. Without the patch, this would have been impossible; the range had to be restricted to [-, ]. Unfortunately I got sidetracked reviewing the rest of the function (today I started out on a mechanical proof of the nth-root part). I *did* review the changes though, and I think they are correct. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12080 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12014] str.format parses replacement field incorrectly
Petri Lehtinen pe...@digip.org added the comment: PEP 3101 defines format strings as intermingled character data and markup. Markup defines replacement fields and is delimited by braces. Only after markup is extracted does the PEP talk about interpreting the contents of the markup. So, given {0[a}b]} the parser first parses out the character data and the markup. The first piece of markup is {0[a}. That gives a syntax error because it's missing a right bracket. I realize you'd like the parser to find the markup as the entire string, but that's not how I read the PEP. This is a good point, although the support of further replacement fields inside format_specifiers requies the parser to count matching braces, if the markup is to be extracted before its interpreted. But disallowing unmathced '}' inside the replacement field doesn't still explain why this shouldn't work: '{0[!]!r}'.format({'!': 'foo'}) I'm completely fine with disallowing '}', but it seems to me that there's absolutely no reason to not parse the element_index and later fields correctly with respect to '!' and ':'. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12014 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12164] str.translate docstring doesn't mention that 'table' can be None
Petri Lehtinen pe...@digip.org added the comment: What do you think? Sounds very good to my native Finnish ears :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12164 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12248] __dir__ semantics changed in Python 2.7.2
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file22246/dir.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12248 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12164] str.translate docstring doesn't mention that 'table' can be None
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12164 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12248] __dir__ semantics changed in Python 2.7.2
Soren Hansen so...@linux2go.dk added the comment: When I first investigated this problem (I reported the original bug on Launchpad), my first attempt to address this issue in pymox had me quite stumped. The class in question has a __getattr__ method. Up until now, this hasn't affected the use of dir(), but it does now. I really just wanted it return whatever it used to return (since that has worked so far), but realising that this was an old-style class, I couldn't just call super(TheClass, self).__dir__(). So my question is: If this change stays (which seems clear given that the only changes proposed here are ways of relaxing the type requirement of the __dir__ method's return value, not reverting the change altogether), and I have an old-style class with a __getattr__ defined, how do I make that class return whatever it would have usually returned for __dir__()? -- nosy: +soren ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12248 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12248] __dir__ semantics changed in Python 2.7.2
Benjamin Peterson benja...@python.org added the comment: 2011/6/4 Soren Hansen rep...@bugs.python.org: Soren Hansen so...@linux2go.dk added the comment: When I first investigated this problem (I reported the original bug on Launchpad), my first attempt to address this issue in pymox had me quite stumped. The class in question has a __getattr__ method. Up until now, this hasn't affected the use of dir(), but it does now. I really just wanted it return whatever it used to return (since that has worked so far), but realising that this was an old-style class, I couldn't just call super(TheClass, self).__dir__(). So my question is: If this change stays (which seems clear given that the only changes proposed here are ways of relaxing the type requirement of the __dir__ method's return value, not reverting the change altogether), and I have an old-style class with a __getattr__ defined, how do I make that class return whatever it would have usually returned for __dir__()? Yes, this is a limitation of magic methods on old style classes. The usual method is something like this: def __getattr__(self, name): if name == __dir__: return self.__dir__ # Other stuff Of course, the best fix is to use new-style classes. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12248 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12262] Not Inheriting File Descriptors on Windows?
sbt shibt...@gmail.com added the comment: Although Windows fds are not inheritable, the handles associated with fds can be made inheritable. A workaround for the fact fds are not inheritable is the following pattern: 1) The parent process converts the fd to a handle using _get_osfhandle(fd). 2) The parent process makes the handle inheritable (if it is not already) using SetHandleInformation() or DuplicateHandle(). 3) The parent process starts the child process and passes the handle number on the commandline. 4) The child process gets the handle number by parsing the commandline. 5) The child process uses _open_osfhandle(handle, flags) to convert the handle into an fd. Note that Python has open_osfhandle() and get_osfhandle() in the msvcrt module. In C, _open_osfhandle() and _get_osfhandle() are declared in io.h. -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10935] wsgiref.handlers.BaseHandler and subclasses of str
Phillip J. Eby p...@telecommunity.com added the comment: That change to the spec is fine, though you might also want to add something like, Like all other WSGI specification types, since *all* types specified in WSGI are 'type()' not 'isinstance()'. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10935 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12248] __dir__ semantics changed in Python 2.7.2
Soren Hansen so...@linux2go.dk added the comment: 2011/6/4 Benjamin Peterson rep...@bugs.python.org: 2011/6/4 Soren Hansen rep...@bugs.python.org: So my question is: If this change stays (which seems clear given that the only changes proposed here are ways of relaxing the type requirement of the __dir__ method's return value, not reverting the change altogether), and I have an old-style class with a __getattr__ defined, how do I make that class return whatever it would have usually returned for __dir__()? Yes, this is a limitation of magic methods on old style classes. The usual method is something like this: def __getattr__(self, name): if name == __dir__: return self.__dir__ # Other stuff Of course, the best fix is to use new-style classes. :) If I do this: = test.py == class Foo: def __getattr__(self, name): if name == '__dir__': return self.__dir__ return 'something else' a = Foo() print dir(a) After a lot of this: File test.py, line 4, in __getattr__ return self.__dir__ File test.py, line 4, in __getattr__ return self.__dir__ File test.py, line 4, in __getattr__ return self.__dir__ ...I end up with a RuntimeError: maximum recursion depth exceeded. I can't say I'm surprised :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12248 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12248] __dir__ semantics changed in Python 2.7.2
Benjamin Peterson benja...@python.org added the comment: 2011/6/4 Soren Hansen rep...@bugs.python.org: Soren Hansen so...@linux2go.dk added the comment: 2011/6/4 Benjamin Peterson rep...@bugs.python.org: 2011/6/4 Soren Hansen rep...@bugs.python.org: So my question is: If this change stays (which seems clear given that the only changes proposed here are ways of relaxing the type requirement of the __dir__ method's return value, not reverting the change altogether), and I have an old-style class with a __getattr__ defined, how do I make that class return whatever it would have usually returned for __dir__()? Yes, this is a limitation of magic methods on old style classes. The usual method is something like this: def __getattr__(self, name): if name == __dir__: return self.__dir__ # Other stuff Of course, the best fix is to use new-style classes. :) If I do this: = test.py == class Foo: def __getattr__(self, name): if name == '__dir__': return self.__dir__ return 'something else' a = Foo() print dir(a) After a lot of this: File test.py, line 4, in __getattr__ return self.__dir__ File test.py, line 4, in __getattr__ return self.__dir__ File test.py, line 4, in __getattr__ return self.__dir__ ...I end up with a RuntimeError: maximum recursion depth exceeded. I can't say I'm surprised :) Ah, sorry I should have thought before writing that. :) self.__class__.__dir__.__get__(self, self.__class__) should work, though. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12248 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12248] __dir__ semantics changed in Python 2.7.2
Soren Hansen so...@linux2go.dk added the comment: 2011/6/5 Benjamin Peterson rep...@bugs.python.org: 2011/6/4 Soren Hansen rep...@bugs.python.org: ...I end up with a RuntimeError: maximum recursion depth exceeded. I can't say I'm surprised :) Ah, sorry I should have thought before writing that. :) self.__class__.__dir__.__get__(self, self.__class__) should work, though. Yeah, that one does seem to work. Excellent, thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12248 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12263] punycode codec ignores the error handler argument
New submission from STINNER Victor victor.stin...@haypocalc.com: b'abc\xff'.decode('punycode', 'ignore') raises the same error than b'abc\xff'.decode('punycode', 'replace') or b'abc\xff'.decode('punycode'): it uses the strict error handler, and simply ignores the error handler. punycodec, as idna, should raise an exception if the error handler is different than strict. -- messages: 137666 nosy: haypo priority: normal severity: normal status: open title: punycode codec ignores the error handler argument versions: Python 2.7, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12263 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12263] punycode codec ignores the error handler argument
STINNER Victor victor.stin...@haypocalc.com added the comment: base64_codec.py uses an assertion to check the error handler: it should use an if+raise (assertions are ignored in optimized mode, python -O). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12263 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12264] parser.expr(): reference count error if more than one argument is passed
New submission from STINNER Victor victor.stin...@haypocalc.com: import parser; parser.expr(a, b) raises a TypeError('expr() takes at most 1 argument (2 given)') but corrupt also the reference count of an object (I don't know which one): python: Modules/gcmodule.c:327: visit_decref: Assertion `gc-gc.gc_refs != 0' failed. -- components: Library (Lib) messages: 137668 nosy: haypo priority: normal severity: normal status: open title: parser.expr(): reference count error if more than one argument is passed versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12264 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
Terry J. Reedy tjre...@udel.edu added the comment: Return a float with the magnitude of x but the sign of y. This appears to describe both current behavior and what I believe was the intention. I would go with a doc patch based on this. umedoblock, go ahead and make one. It occurred to me, also, that as currently written, copysign 'should' return the type of the first arg. In C89, and I suspect in Python 1.0, all math functions return double (Python float). Like Mark, I am more inclined to change the doc than the code. 1. One use of copysign is to give a correctly signed 0.0. This does not apply to ints, where 0 is always unsigned. I do not know of any use of copysign in number (count/int) theory. (There could be, of course.) 2. icopysign(-1,0) == +1 (sign added for emphasis), whereas I believe that for ints, the answer should be -1, as 0 has no sign. def icopysign(j,k): if (j 0) and (k 0) or (j 0) and (k 0): return -j return j for j,k,i in ((1,1,1), (1,-1,-1), (-1,-1,-1), (-1, 1, 1), (1,0,1), (-1,0,-1)): assert icopysign(j,k) == i, (j,k,i) This would certainly be up for debate if we changed the code, but there should be no difference in outputs for same value inputs. (This principle is the reason for / and //.) So lets leave copysign as a function defined on floats with inputs coerced to float if needed. Anyone who needs it for ints can define it for (-1,0) according to their need. -- assignee: - docs@python components: +Documentation -Library (Lib) nosy: +docs@python stage: - needs patch versions: +Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12246] create installation path if it's non-existent
Tshepang Lekhonkhobe tshep...@gmail.com added the comment: But this part of the code runs only when you want to install a 3rd party module isn't it? What you are proposing simply adds a delay, for the use will have to then add that directory manually. Or is there something I'm missing here? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12246 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12246] create installation path if it's non-existent
Tshepang Lekhonkhobe tshep...@gmail.com added the comment: s/use/user -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12246 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12232] embedded python import cmath
Terry J. Reedy tjre...@udel.edu added the comment: {It you reply by mail, please snip off the message you are replying to.} From what I have read, Windows is not a very pleasant environment for extending and embedding. 1. It works best if both Python and the extender or embedder are compiled with the same version (of Microsoft VC). Does Borland Builder 6 claim compatibility with any particular versions of MS C++? 2. Problems like this probably need a debug build of Python, which you would have to make yourself, and unlike *nux, Windows does not come with a system compiler. (There is now, however, a free VC Express, but I believe the one needed to go with 2.6 is no longer available ;-(. I am inclined to close this both because it does not involve current Python and because it appears to be an issue with BB or the interface that is out of our control (as you said, Python by itself works fine). I am only leaving this open to give you a chance to provide evidence otherwise with 2.7 or 3.2. I recommend that you might try the trivial 'import cmath\n' with other Python versions. Which versions would depend on what BB6 claims to be compatible with. I also recommend that you ask for help on python-list or other forums (such a Stackoverflow). Use a subject like Embedding Python 2.6 with Borland Builder 6 This might catch the attention of someone who knows something about BB. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12232 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
umedoblock umedobl...@gmail.com added the comment: I made the patch. But it cannot pass testCopysign(). math.copysign(1, -0.) returns 1. I hope to return -1. But I don't know how to realize -0. as negative value. Please help me. -- components: +Library (Lib) -Documentation keywords: +patch versions: -Python 2.7, Python 3.3 Added file: http://bugs.python.org/file22249/math_copysign.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
Changes by umedoblock umedobl...@gmail.com: Removed file: http://bugs.python.org/file22249/math_copysign.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
Changes by umedoblock umedobl...@gmail.com: Added file: http://bugs.python.org/file22250/math_copysign.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
Changes by umedoblock umedobl...@gmail.com: Removed file: http://bugs.python.org/file22250/math_copysign.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
Terry J. Reedy tjre...@udel.edu added the comment: umedoblock: David, Mark, and I agree that this should be a doc issue, and so I suggested a DOC patch. So I do not know why you are screwing around with the code, or what you are trying to do with it, or why you are messing around with the version headers or why you think this is a 3.2 only issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
umedoblock umedobl...@gmail.com added the comment: sorry. I fix my bug. but this patch contain new fail... math.copysign(-1., 0.) returns 1. -- Added file: http://bugs.python.org/file22251/math_copysign.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12265] revamp argument errors
New submission from Benjamin Peterson benja...@python.org: This patch completely rewrites errors given for positional error mismatches. The goal is to give more informative and correct errors. Some examples: def f(): pass ... f(1) Traceback (most recent call last): File stdin, line 1, in module TypeError: f() takes 0 positional arguments but 1 was given f(1, kw=4) Traceback (most recent call last): File stdin, line 1, in module TypeError: f() got an unexpected keyword argument 'kw' def f(a, b=2): pass ... f() Traceback (most recent call last): File stdin, line 1, in module TypeError: f() takes from 1 to 2 positional arguments but 0 were given f(1, 2, 3) Traceback (most recent call last): File stdin, line 1, in module TypeError: f() takes from 1 to 2 positional arguments but 3 were given def f(a, *b): pass ... f() Traceback (most recent call last): File stdin, line 1, in module TypeError: f() takes at least 1 positional argument but 0 were given f(kw=4) Traceback (most recent call last): File stdin, line 1, in module TypeError: f() got an unexpected keyword argument 'kw' When keyword-only arguments come into play, things get a bit more complicated. When a positional argument error occurs, it's confusing to report only the positional arguments, but not completely relevant to report keyword-only arguments. I comprise by putting the keyword-only argument information in parenthesis. Tell me if you have a better idea. def f(*, kw): pass ... f() Traceback (most recent call last): File stdin, line 1, in module TypeError: f() requires keyword-only argument 'kw' f(1) Traceback (most recent call last): File stdin, line 1, in module TypeError: f() takes 0 positional arguments but 1 was given f(3, kw=4) Traceback (most recent call last): File stdin, line 1, in module TypeError: f() takes 0 positional arguments but 1 positional arguments (and 1 keyword-only argument) were given -- components: Interpreter Core files: argerror.patch keywords: patch messages: 137676 nosy: benjamin.peterson priority: normal severity: normal stage: patch review status: open title: revamp argument errors type: feature request versions: Python 3.3 Added file: http://bugs.python.org/file22252/argerror.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12265 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12265] revamp argument errors
Changes by Benjamin Peterson benja...@python.org: Removed file: http://bugs.python.org/file22252/argerror.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12265 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12265] revamp argument errors
Changes by Benjamin Peterson benja...@python.org: Added file: http://bugs.python.org/file22253/argerror.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12265 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12264] parser.expr(): reference count error if more than one argument is passed
Roundup Robot devnull@devnull added the comment: New changeset 3ffd8dea77bf by Benjamin Peterson in branch 'default': only clear the parser error if it's set (closes #12264) http://hg.python.org/cpython/rev/3ffd8dea77bf -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12264 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4949] Constness in PyErr_NewException
Andreas Kloeckner inf...@tiker.net added the comment: ping? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12211] math.copysign must keep object type.
umedoblock umedobl...@gmail.com added the comment: I attached DOC patch. I misunderstand ? Sorry... I think that go ahead and make one means I shuold make the source patch. I use just Python3.2. I didn't use Python 2.x, 3.0 and 3.1 in my programming life. Therefore I reported version 3.2. I should the versions to 3rd party ? -- Added file: http://bugs.python.org/file22254/math.rst.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12211 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4949] Constness in PyErr_NewException
Benjamin Peterson benja...@python.org added the comment: This patch is not applicable anymore to 3.x. -- nosy: +benjamin.peterson resolution: - out of date status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12265] revamp argument errors
Nick Coghlan ncogh...@gmail.com added the comment: Looks good in a desk review. Assuming the full test suite passes, +1 from me. -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12265 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12266] str.capitalize contradicts
New submission from py.user port...@yandex.ru: specification str.capitalize()¶ Return a copy of the string with its first character capitalized and the rest lowercased. '\u1ffc', '\u1ff3' ('ῼ', 'ῳ') '\u1ffc'.isupper() False '\u1ff3'.islower() True s = '\u1ff3\u1ff3\u1ffc\u1ffc' s 'ῳῳῼῼ' s.capitalize() 'ῼῳῼῼ' A: lower B: title A - B !B - A -- components: Interpreter Core messages: 137682 nosy: py.user priority: normal severity: normal status: open title: str.capitalize contradicts versions: Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12266 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com