Re: [Python-Dev] co_firstlineno on decorated functions
On Tue, Aug 3, 2010 at 10:14 AM, Guido van Rossum gu...@python.org wrote: What are the use cases for co_firstlineno? Even if it is for displaying the source code, I can find virtue for both sides of this argument. nose uses co_firstlineno to determine order of the test functions and decorating a test function can change such order. To keep the ordering, it provides nose.tools.make_decorator() which explicitly keeps the line number of the original function. Check the following thread for a discussion in this regard: http://groups.google.com/group/nose-users/browse_thread/thread/3e354cbb5b1fac6/107429c5abbf2e59 Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Very Strange Argument Handling Behavior
On Fri, Apr 16, 2010 at 12:57 AM, Alex Gaynor alex.gay...@gmail.com wrote: Hi all, I ran into the follow behavior while making sure Django works correctly on PyPy. The following behavior was observed in all tested versions of CPython (2.5, 3.1): def f(**kwargs): ... print(kwargs) ... kwargs = {1: 3} dict({}, **kwargs) {1: 3} f(**kwargs) Traceback (most recent call last): File stdin, line 1, in module TypeError: f() keywords must be strings This behavior seems pretty strange to me, indeed PyPy gives the TypeError for both attempts. I just wanted to confirm that it was in fact intentional. I ran into same issue with Django on Jython yesterday [1] since Jython too gives TypeError for 'dict({}, **kwargs)'. Thanks, Raghu [1] http://bugs.jython.org/issue1600 ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] IDLE reading IDLESTARTUP or PYTHONSTARTUP on restart
On Wed, Feb 11, 2009 at 1:45 PM, Mitchell L Model mlmli...@comcast.net wrote: I have a patch for IDLE, but I've never submitted a patch before and not quite sure of the procedure, despite reading the guidelines at http://www.python.org/dev/patches/. But I'll be brave and persevere. The question I have at the moment is should I only submit the patch vs. 3.1 or also for 3.0? 2.7? 2.6? 2.5? The guidelines listed above clearly state that patches should be sent relative to the current SVN tree. That would be 2.7, I guess. In addition, I would suggest uploading the patch to http://codereview.appspot.com which makes reviewing simpler. Perhaps, the guidelines page can mention this point. Guidance on all of these would be greatly appreciated. The patch itself disturbs things in a half-dozen places, but in very minimal ways, so it's The recommended way is to create a tracker issue (with or without patch) and send a mail here with the issue link and a brief description. That will allow interested people to check the issue and add comments. Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [patch] Duplicate sections detection in ConfigParser
The attached patch is compatible with both the 2.x and the 3.x branches; it adds a `unique_sects` parameter to the constructor of RawConfigParser and a test in the parser loop that raises DuplicateSectionError if a section is seen more then once and that unique_sects is True. http://bugs.python.org/issue2204 refers to the same issue. Perhaps, you can upload your patch there in addition to adding any comments. Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] My patches
On Thu, Oct 30, 2008 at 11:55 AM, Paul Moore [EMAIL PROTECTED] wrote: I just did a quick experiment, checking for trivial documentation patches I could review, and some things became obvious: 1. There is no way of telling which issues have a patch. There is a patch keyword that is usually set for issues with patches and search can be done for given keywords. Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Invitation to try out open source code review tool
On Mon, May 5, 2008 at 12:28 PM, Guido van Rossum [EMAIL PROTECTED] wrote: None of these seem insurmountable, so now that it's open source, I'm looking forward to contributions. Are there any mailing lists associated with this project? I looked at google code page but couldn't find any. Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Invitation to try out open source code review tool
Are there any mailing lists associated with this project? I looked at google code page but couldn't find any. Not yet. Do you want me to create a Google group for it? I think that will be very useful. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] socket.try_reuse_address()
On Wed, Apr 30, 2008 at 1:42 PM, Trent Nelson [EMAIL PROTECTED] wrote: if os.name == nt: _socketmethods = _socketmethods + ('ioctl',) +_is_windows = True +elif os.name == 'java': +from java.lang import System +_is_windows = 'windows' in System.getProperty('os.name').lower() This one will not work. 'windows' in System.getProperty('os.name').lower() Traceback (innermost last): File console, line 1, in ? TypeError: string member test needs char left operand You may have to do something like System.getProperty('os.name').lower().find('windows'). ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] socket.try_reuse_address()
On Wed, Apr 30, 2008 at 2:07 PM, Trent Nelson [EMAIL PROTECTED] wrote: This one will not work. 'windows' in System.getProperty('os.name').lower() Traceback (innermost last): File console, line 1, in ? TypeError: string member test needs char left operand Interesting, which version of Jython were you using? 2.1. Now that you mentioned it, I tested with 2.2 and your code works there. You may have to do something like System.getProperty('os.name').lower().find('windows'). That didn't work for me. I assume the following works for you: System.getProperty('os.name').lower().startswith('windows') It does. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] socket.SOL_REUSEADDR: different semantics between Windows vs Unix (or why test_asynchat is sometimes dying on Windows)
On Sat, Apr 5, 2008 at 1:22 PM, Trent Nelson [EMAIL PROTECTED] wrote: Nod, if SO_EXCLUSIVEADDRUSE is used instead in the code I posted, Windows raises EADDRINUSE on the second bind(). I don't have access to any Linux boxes at the moment, so I can't test what sort of error is raised with the example I posted if listen() and accept() are called on the two sockets bound to identical addresses. Can anyone else shed some light on this? I'd be interested in knowing if the process wedges on Linux as badly as it does on Windows (to the point where it's not respecting ctrl-c or sigkill). When I call sock1.listen(5) after sock1.bind(), the test passes for me on SuSE Linux 10.1 Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Small RFEs and the Bug Tracker
Renaming it is easy. To the native speakers reading it: What should it be called? (please try to come up with something shorter than request for enhancement) feature request? How about calling it just enhancement? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] bugs.pythong.org bug?
On Feb 6, 2008 2:54 PM, Joseph Armbruster [EMAIL PROTECTED] wrote: - went to bugs.python.org - clicked search (on the lhs of the page) - typed in josepharmbruster as creator - clicked search I will create an issue if deemed necessary. Joseph Armbruster exceptions.KeyError: There seems to be a bug open for this problem: http://psf.upfronthosting.co.za/roundup/meta/issue179 For tracker issues, the right place to ask is tracker-discuss list. Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Returning exception stack trace in SimpleXMLRPCServer response
Hi, When an exception occurs in a function, SimpleXMLRPCServer currently sends exception type and value back to the client (in faultString) . So the client sees some thing like: 'type \'exceptions.ValueError\':invalid literal for int() with base 10 This string is constructed in _marshaled_dispatch() as %s:%s % (exc_type, exc_value). How about adding the stack traceback to this string? I found it very useful to have the server side traceback in case of failures. I will come up with a patch if there is any interest. Some thing similar has been done in case of internal server errors (in r57158). Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [Tracker-discuss] Python tickets summary
On 9/13/07, Facundo Batista [EMAIL PROTECTED] wrote: http://www.taniquetil.com.ar/facundo/py_tickets.html It looks like the column Opened by contains information for Last update by and vice versa. At least, that is the case with issue 1159. Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] error in Misc/NEWS
On 6/1/07, Georg Brandl [EMAIL PROTECTED] wrote: Raghuram Devarakonda schrieb: There is an entry in Core and builtins section of Misc/NEWS: Bug #1722484: remove docstrings again when running with -OO.. The actual bug is 1722485. Incidentally, 1722484 appears to be spam. Fixed, thanks for spotting (you really read the commit logs thoroughly, don't you? ;) I was just scanning the file for the comment related to my patch (my first one, btw) when I spotted this. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] removing use of mimetools, multifile, and rfc822
On 5/31/07, Barry Warsaw [EMAIL PROTECTED] wrote: In other words this email is to hopefully inspire someone to remove the uses of rfc822, mimetools, and multifile from the stdlib so the DeprecationWarnings can finally go in. +1 for deprecating these. I don't have time to slog through the stdlib and do the work, but I would be happy to help answer questions about alternatives. I will give it a shot and will try to come up with a patch. Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] os.rename on windows
On 5/1/07, Scott Dial [EMAIL PROTECTED] wrote: The cygwin implementation of rename goes like this: 1) Try to use MoveFile 2) Try to use MoveFileEx(..., MOVEFILE_REPLACE_EXISTING) 3) Try to unlink destination, then try to use MoveFile And as you say, Cygwin claims it meets POSIX.1. And, POSIX.1 says, If newpath already exists it will be atomically replaced (subject to a few conditions; see ERRORS below), so that there is no point at which another process attempting to access newpath will find it missing. Clearly, unliking and then calling MoveFile is not atomic. So, cygwin is not being honest here because in these less frequent cases, the rename will not be atomic. You are right. I just checked cygwin's rename() code and it is convincing enough for me to withdraw the patch. Thanks for all the comments. Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] os.rename on windows
Hi, I have submitted a patch (http://www.python.org/sf/1704547) that allows os.rename to replace the destination file if it exists, on windows. As part of discussion in the tracker, Martin suggested that python-dev should discuss the change. Currently, os.rename() on windows uses the API MoveFile() which fails if the destination file exists. The patch replaces this API with MoveFileEx() and uses the flag MOVEFILE_REPLACE_EXISTING which causes the destination file to be replaced if it exists. However, this change is subtle and if there is any existing code that depends on current os.rename behaviour on windows, their code is silently broken with (any) destination file being overwritten. But the functionality of replacing is important and I would like to know the best of way of supporting it. If it is deemed that this change is not good to go in as-is, how about having an optional parameter to os.rename (say, win_replace) that can be used by callers to explicitly request replacing? I must also point out that the patch uses another flag MOVEFILE_COPY_ALLOWED effectively allowing renamed files to be on separate file systems. The renaming in this case is not atomic and I used this flag only to support current functionality. It is not a bad idea to disallow such renames which brings it in line with the behaviour on many unix flavors. This also has the potential to break code but not silently. Lastly, I found an old discussion about the same topic by this list. http://mail.python.org/pipermail/python-dev/2001-May/014957.html Even though Guido indicated that he doesn't support API change in this thread, I am posting again as I did not see any one mention MoveFileEx() in that thread. Thanks, Raghu. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] os.rename on windows
On 4/30/07, Andrew Bennetts [EMAIL PROTECTED] wrote: Does MOVEFILE_REPLACE_EXISTING mean the rename over an existing file is actually atomic? I cannot find any MSDN docs that say so (and I've seen some that suggest to me that it probably isn't). Even though MSDN docs do not say it explicitly, I found some discussions claiming that MOVEFILE_REPLACE_EXISTING is atomic. However, after seeing your comment, I did a more thorough search and I too found some references claiming otherwise. As a last resort, I checked cygwin documentation which claims that it's rename() is POSIX.1 compliant. If I am not mistaken, POSIX.1 does require atomicity so I am curious how rename() is implemented there. I checked out the sources and I will try to find more about their implementation. I completely agree that without positive proof of atomicity, there is no point in making this code change. Also, I assume this cannot replace files that are in use? A simple test shows that it can indeed replace files that are open. Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Python 2.5.1
On 4/28/07, Calvin Spealman [EMAIL PROTECTED] wrote: Index: test_os.py === --- test_os.py (revision 54982) +++ test_os.py (working copy) @@ -6,6 +6,7 @@ import unittest import warnings import sys +import tempfile from test import test_support warnings.filterwarnings(ignore, tempnam, RuntimeWarning, __name__) @@ -241,13 +242,18 @@ self.assertEquals(os.stat(self.fname).st_mtime, t1) def test_1686475(self): +fn = tempfile.mktemp() +openfile = open(fn, 'w') # Verify that an open file can be stat'ed try: -os.stat(rc:\pagefile.sys) +os.stat(fn) except WindowsError, e: if e == 2: # file does not exist; cannot run test return self.fail(Could not stat pagefile.sys) +finally: +openfile.close() +os.remove(fn) from test import mapping_tests mktemp() is deprecated. You may want to use mkstemp(). There will be no need for explicit open as well as mkstemp() also returns open descriptor. Thanks, Raghu. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] some bug reviews
Hi, The following two bugs can be closed with possible document update. I have put my suggestions for doc changes in the SF tracker. -- http://python.org/sf/1615275 - tempile.TemporaryFile differences between linux and windows http://python.org/sf/1633941 - for line in sys.stdin: doesn't notice EOF the first time I opened 1643712 to request doc change for this bug. --- http://python.org/sf/1668596 - distutils chops the first character of filenames This one requires no action and can be closed, IMO. Thanks, Raghu ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] build problem on windows: unable to find getbuildinfo2.c
On 4/13/07, Martin v. Löwis [EMAIL PROTECTED] wrote: I didn't find getbuildinfo2.c in the source. Can some one tell me if I am missing some thing here? Are there any additional steps need to follow on windows? It's a generated file. Search all build description files for that file name to find out how it is generated, and then research why generating it fails on your machine. Thanks. I found that make_buildinfo project failed with some unresolved symbol errors causing the missing getbuildinfo2.c. Once I fixed it, python got built just fine. ___ Python-Dev mailing list [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] build problem on windows: unable to find getbuildinfo2.c
Hi, I am trying to build latest python on Windows XP and ran into the following error: c1 : fatal error C1083: Cannot open source file: '.\getbuildinfo2.c': No such file or directory I am using Visual C++ 2005 Express Edition to build. I opened PCbuilld8/pcbuild.sln and did a release build of pythoncore. I didn't find getbuildinfo2.c in the source. Can some one tell me if I am missing some thing here? Are there any additional steps need to follow on windows? Thanks, Raghu. ___ Python-Dev mailing list [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] About SSL tests
On 4/2/07, Facundo Batista [EMAIL PROTECTED] wrote: I launch openssl through subprocess, but I do *not* find a way to tell him to quit serving, so all I can do is to kill the process (through the pid from the Popen object). The problem is that os.kill only works in Unix and Macintosh. So, there's a better way to do this? Or I shall check if I'm in one of those both platforms and only execute the tests there? I just checked the man page for s_server (on linux) and it mentions something about exiting. Certain single letter commands are also recognized which perform special operations: these are listed below. q end the current SSL connection but still accept new connections. Q end the current SSL connection and exit. Can a command Q be sent to the server once testing is complete? Thanks, Raghu. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] adding _Py prefix to names in 2.5.1?
On 1/18/07, Martin v. Löwis [EMAIL PROTECTED] wrote: Neal Norwitz schrieb: http://python.org/sf/1637022 points out a problem caused by the lack of a _Py prefix on Ellipsis. Most (all?) of the new AST names are not prefixed. These are all meant to be internal names. Are there any issues with changing this? If we do so, it means that any module built with 2.5 that is using these names will fail to work in 2.5.1. No code outside the core *should* be using these names. I'll look into this. I will create macros in the header file for them, so that existing source code will continue to compile. Regards, Martin Hi, I started to look into this based on Neal's suggestions (in offline conversation). Please let me know if you want me to continue. Thanks, Raghu. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com