Re: Retrieving an object from a set
Vito De Tullio wrote: MRAB wrote: It turns out that both S {x} and {x} S return {x}, not {y}. curious. $ python Python 2.7.3 (default, Jul 3 2012, 19:58:39) [GCC 4.7.1] on linux2 Type help, copyright, credits or license for more information. x = (1,2,3) y = (1,2,3) s = set([y]) (s set([x])).pop() is y False (set([x]) s).pop() is y True maybe it's implementation-defined? I think the algorithm looks for the smaller set: set(range(5)) set(map(float, range(10))) set([0, 1, 2, 3, 4]) set(range(10)) set(map(float, range(5))) set([0.0, 1.0, 2.0, 3.0, 4.0]) You have two sets of the same length, so there is no advantage in swapping them before calculating the intersection. -- http://mail.python.org/mailman/listinfo/python-list
Re: mysql solution
Τη Παρασκευή, 25 Ιανουαρίου 2013 11:56:44 μ.μ. UTC+2, ο χρήστης Dennis Lee Bieber έγραψε: = #find the visitor record for the (saved) cID and current host cur.execute('''SELECT * FROM visitors WHERE counterID = %s and host = %s''', (cID, host) ) data = cur.fetchone()#cIDhost are unique if not data: #first time for this host on this page, create new record cur.execute('''INSERT INTO visitors (counterID, host, userOS, browser, lastvisit) VALUES (%s, %s, %s, %s, %s)''', (cID, host, useros, browser, date) ) else: #found the page, save its primary key for later use vID = data[0] #UPDATE record using retrieved vID cur.execute('''UPDATE visitors SET userOS = %s, browser = %s, hits = hits + 1, lastvisit = %s WHERE counterID = %s and host = %s''', (useros, browser, date, vID, host) ) === Instead of the above logic which you provided and it works as expected, wouldn't be easier to just: Try to update the 'visitors' record, for that 'page' and that 'host' if update fails(doesnt return any data), then we insert a new record entry. We dont have to check 'SELECT * FROM visitors WHERE counterID = %s and host = %s' first, this one less cursor.execute. -- http://mail.python.org/mailman/listinfo/python-list
sockobj.connect Errno 13 Permission denied
Hi, I have a client program Client.py which has a statement of sockobj.connect(), the port number 6 is used, so no problem from port permission. I am puzzled because I can run Client.py from command line in my user account or apache user account without any problems. But if I run it from a web page http://localhost/client.php, the client.php called exec(Client.py), then it got an exception of sockobj.connect Errno 13 Permission denied. Why it can run from command line, but cannot make connection from a web file? Appreciate any tips and clues. Thank you. Kind regards. -- http://mail.python.org/mailman/listinfo/python-list
Cancel threads after timeout
Here's the use case I want to implement - I have to generate a report from multiple database servers. This report should be generated every 2 hours. Sometimes it happens that a query on one of the database servers takes longer than expected and impedes the generation of this report (that's right, the queries are ran sequential). What I am trying to achieve is to parallelize the queries on each database server and to be able to cancel one of them if it takes longer than X minutes. threading.Thread doesn't support this and seems that in general programming languages don't implement a way to cancel threads from the outside. Now, I've read all the stackoverflow threads about killing a thread, canceling a thread after a timeout, but all of them imply that you are able to check from within the thread if you should end the computation or not - that's not really my case, where the computation is a SQL query. So, what I have in mind is something like: the main loop starts a threading.Thread which in turn is responsible for starting another thread in which the actual computation happens (could be a threading.Thread or a multiprocessing.Process) *and* checks if the specified timeout has passed. If the time is up, it exits, letting the main loop know. Lots of words, no code - let me know if you have any suggestions, ideas to this rant. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: sockobj.connect Errno 13 Permission denied
On Sat, Jan 26, 2013 at 6:19 AM, nobody jupiter@gmail.com wrote: Hi, I have a client program Client.py which has a statement of sockobj.connect(), the port number 6 is used, so no problem from port permission. I am puzzled because I can run Client.py from command line in my user account or apache user account without any problems. But if I run it from a web page http://localhost/client.php, the client.php called exec(Client.py), Check the arguments to exec. I think it has to be an open file object. then it got an exception of sockobj.connect Errno 13 Permission denied. Why it can run from command line, but cannot make connection from a web file? Appreciate any tips and clues. Thank you. Kind regards. -- http://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- http://mail.python.org/mailman/listinfo/python-list
Re: sockobj.connect Errno 13 Permission denied
On Sat, Jan 26, 2013 at 8:47 AM, Joel Goldstick joel.goldst...@gmail.comwrote: On Sat, Jan 26, 2013 at 6:19 AM, nobody jupiter@gmail.com wrote: Hi, I have a client program Client.py which has a statement of sockobj.connect(), the port number 6 is used, so no problem from port permission. I am puzzled because I can run Client.py from command line in my user account or apache user account without any problems. But if I run it from a web page http://localhost/client.php, the client.php called exec(Client.py), Check the arguments to exec. I think it has to be an open file object. then it got an exception of sockobj.connect Errno 13 Permission denied. Why it can run from command line, but cannot make connection from a web file? Appreciate any tips and clues. Thank you. Kind regards. Maybe I spoke too soon. You should probably be asking in a php forum since what you are doing is running a php exec. If you are actually getting a python error you should show the code and the traceback so that someone can look at your code. In either case (py and php) it looks like exec needs either a string of executable text or (in py case) an open file handle. So the code you describe isn't really what you are running -- http://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick http://joelgoldstick.com -- Joel Goldstick http://joelgoldstick.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Cancel threads after timeout
Sometimes it happens that a query on one of the database servers takes longer than expected and impedes the generation of this report (that's right, the queries are ran sequential). What I am trying to achieve is to parallelize the queries on each database server and to be able to cancel one of them if it takes longer than X minutes. Only answering a small portion of your question Assuming you are able to figure out how to cancel a thread or process on your side, it is possible the database itself will not respect that. In other words, if you execute SELECT ... singly, outside of Python, and type CNTL-C, does your database quickly recognize you are no longer interested in the result set and stop its work? -- http://mail.python.org/mailman/listinfo/python-list
Re: Cancel threads after timeout
It sounds like your real problem is with your SQL query... Is that part of this problem under your control? Can you break the query into smaller, quicker, pieces that you can run in a reasonable amount of time? If not, nesting threads might be your best programmatic solution. Heed Jason's warning though that the SQL Server my still be working even if you cancel an operation from the outside (which could compound your problem). *Matt Jones* On Sat, Jan 26, 2013 at 9:43 AM, Jason Friedman jsf80...@gmail.com wrote: Sometimes it happens that a query on one of the database servers takes longer than expected and impedes the generation of this report (that's right, the queries are ran sequential). What I am trying to achieve is to parallelize the queries on each database server and to be able to cancel one of them if it takes longer than X minutes. Only answering a small portion of your question Assuming you are able to figure out how to cancel a thread or process on your side, it is possible the database itself will not respect that. In other words, if you execute SELECT ... singly, outside of Python, and type CNTL-C, does your database quickly recognize you are no longer interested in the result set and stop its work? -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Python Programming - 28 hours training in New York for $3999
Python Programming - 28 hours training in New York for $3999 Course Outline: http://www.nobleprog.us/python-programming/training-course Course Date: 2013-03-05 09:30 - 2013-03-08 16:30 Course Price: $3999 per person, usually $4730 per person Remarks: A complimentary lunch will be provided Venue: 369 Lexington Ave New York, New York 10017 Please use the link below to book: http://be.nobleprog.us/node/add/course-booking?ce=751 Link(s) to other Courses you might be interested in: http://www.nobleprog.us/python-training-courses Thanks NobleProg LLC If you need any further information please contact us at: train...@nobleprog.us or 646 461 6132 -- http://mail.python.org/mailman/listinfo/python-list
??????????? DOES GOG EXIST
DOES GOG EXIST http://www.youtube.com/watch?v=tRMmTbCXXAkfeature=related THANK YOU -- http://mail.python.org/mailman/listinfo/python-list
Re: sockobj.connect Errno 13 Permission denied
On Sat, Jan 26, 2013, at 08:52 AM, Joel Goldstick wrote: On Sat, Jan 26, 2013 at 8:47 AM, Joel Goldstick joel.goldst...@gmail.comwrote: On Sat, Jan 26, 2013 at 6:19 AM, nobody jupiter@gmail.com wrote: Hi, I have a client program Client.py which has a statement of sockobj.connect(), the port number 6 is used, so no problem from port permission. I am puzzled because I can run Client.py from command line in my user account or apache user account without any problems. But if I run it from a web page http://localhost/client.php, the client.php called exec(Client.py), Check the arguments to exec. I think it has to be an open file object. then it got an exception of sockobj.connect Errno 13 Permission denied. Why it can run from command line, but cannot make connection from a web file? Appreciate any tips and clues. Thank you. Kind regards. Maybe I spoke too soon. You should probably be asking in a php forum since what you are doing is running a php exec. If you are actually getting a python error you should show the code and the traceback so that someone can look at your code. In either case (py and php) it looks like exec needs either a string of executable text or (in py case) an open file handle. So the code you describe isn't really what you are running Also your php/apache config needs to be set up to enable execs (I think it's off by the default). Either way it's a PHP question, not a Python question. -- http://mail.python.org/mailman/listinfo/python-list
Formatting a column's value output
try: cur.execute( '''SELECT URL, hits FROM counters ORDER BY hits DESC''' ) except MySQLdb.Error, e: print ( Query Error: , sys.exc_info()[1].excepinfo()[2] ) else: data = cur.fetchall() for row in data: print ( tr ) for item in row: print ( tdbfont color=yellow %s /td % item ) sys.exit(0) = In the aboce code wheb 'URL' is to be typed out be print i need it to be formatted as a link, so the viewer can click on it. Is this possible please? Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
On Sun, Jan 27, 2013 at 4:51 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: print ( tdbfont color=yellow %s /td % item ) In the aboce code wheb 'URL' is to be typed out be print i need it to be formatted as a link, so the viewer can click on it. Is this possible please? Easy, just make a tuple of item,item and have two %s markers: print( tdbfont color=yellowa href='%s'%s/a/td % (item, item) ) But you need to concern yourself with escaping. In fact, you already needed to, just to produce it as text - but it's now even more important. I strongly suggest you look into that. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
python: HTTP connections through a proxy server requiring authentication
Hi, I followed http://dabase.com/blog/Minimal_squid3_proxy_configuration/ to setup proxy server. I tested my proxy server with firefox with IP:127.0.0.1 and Port:3128 and it working (asking for proxy username and password). But, i could not make http connection through proxy server requiring authentication using following python code.. ## Python code ## import urllib2 proxy = urllib2.ProxyHandler({'http':'http://saju:123@saju-Inspiron-N5010:3128'}) opener = urllib2.build_opener(proxy, urllib2.HTTPHandler) urllib2.install_opener(opener) conn = urllib2.urlopen('http://python.org') return_str = conn.read() print ===return_st, return_str ERROR Traceback (most recent call last): File my_proxy.py, line 6, in module conn = urllib2.urlopen('http://python.org') File /usr/lib/python2.7/urllib2.py, line 127, in urlopen return _opener.open(url, data, timeout) File /usr/lib/python2.7/urllib2.py, line 407, in open response = meth(req, response) File /usr/lib/python2.7/urllib2.py, line 520, in http_response 'http', request, response, code, msg, hdrs) File /usr/lib/python2.7/urllib2.py, line 445, in error return self._call_chain(*args) File /usr/lib/python2.7/urllib2.py, line 379, in _call_chain result = func(*args) File /usr/lib/python2.7/urllib2.py, line 528, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 407: Proxy Authentication Required ## Proxy Server Settings ## sudo vim /etc/squid3/squid.conf --- auth_param digest program /usr/lib/squid3/digest_pw_auth -c /etc/squid3/passwords auth_param digest realm saju-Inspiron-N5010 acl authenticated proxy_auth REQUIRED http_access allow authenticated http_port 3128 Setting up user -- htdigest -c /etc/squid3/passwords saju-Inspiron-N5010 saju == -- http://mail.python.org/mailman/listinfo/python-list
Re: python: HTTP connections through a proxy server requiring authentication
Hi, /etc/squid3/squid.conf --- saju@saju-Inspiron-N5010:~$ cat squid.conf | grep ^[^#] auth_param digest program /usr/lib/squid3/digest_pw_auth -c /etc/squid3/passwords auth_param digest realm saju-Inspiron-N5010 acl manager proto cache_object acl localhost src 127.0.0.1/32 ::1 acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 acl authenticated proxy_auth REQUIRED acl SSL_ports port 443 acl Safe_ports port 80# http acl Safe_ports port 21# ftp acl Safe_ports port 443# https acl Safe_ports port 70# gopher acl Safe_ports port 210# wais acl Safe_ports port 1025-65535# unregistered ports acl Safe_ports port 280# http-mgmt acl Safe_ports port 488# gss-http acl Safe_ports port 591# filemaker acl Safe_ports port 777# multiling http acl CONNECT method CONNECT http_access allow manager localhost http_access deny manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow authenticated http_access deny all http_port 3128 coredump_dir /var/spool/squid3 refresh_pattern ^ftp:144020%10080 refresh_pattern ^gopher:14400%1440 refresh_pattern -i (/cgi-bin/|\?) 00%0 refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880 refresh_pattern .020%4320 saju@saju-Inspiron-N5010:~$ Thanks, -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
Τη Σάββατο, 26 Ιανουαρίου 2013 8:04:12 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Sun, Jan 27, 2013 at 4:51 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: print ( tdbfont color=yellow %s /td % item ) In the aboce code wheb 'URL' is to be typed out be print i need it to be formatted as a link, so the viewer can click on it. Is this possible please? Easy, just make a tuple of item,item and have two %s markers: print( tdbfont color=yellowa href='%s'%s/a/td % (item, item) ) But you need to concern yourself with escaping. In fact, you already needed to, just to produce it as text - but it's now even more important. I strongly suggest you look into that. I can use triple (''') quoting so i dont have to escape special characters. But i didnt understand you suggestion about the tuple. The dataset returns many lines and i need to transfor only the URL column Sorry i did not understood. -- http://mail.python.org/mailman/listinfo/python-list
Re: Need Pattern For Logging Into A Website
On 01/26/2013 12:53 AM, Michael Torrie wrote: On 01/25/2013 05:15 PM, Tim Daneliuk wrote: Does it handle self-signed SSL certs? No idea. you'd have to try it. OK, thanks for the pointer. -- Tim Daneliuk tun...@tundraware.com PGP Key: http://www.tundraware.com/PGP/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
Τη Σάββατο, 26 Ιανουαρίου 2013 8:04:12 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Sun, Jan 27, 2013 at 4:51 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: print ( tdbfont color=yellow %s /td % item ) In the aboce code wheb 'URL' is to be typed out be print i need it to be formatted as a link, so the viewer can click on it. Is this possible please? Easy, just make a tuple of item,item and have two %s markers: print( tdbfont color=yellowa href='%s'%s/a/td % (item, item) ) That code works, but it creates links for both the URL and hits columns! Only the URL must be linked not the hits column! -- http://mail.python.org/mailman/listinfo/python-list
Re: word_set [snip enormous subject line]
Martin Musatov wrote: word_set = set() [snip SIXTEEN THOUSAND words copied from a spelling dictionary] If you have a question, please: - ASK THE QUESTION, we cannot read your mind; - don't send us thousands of lines taken straight out of a dictionary, just use the SMALLEST amount of sample data needed to demonstrate the problem; three or four words is enough, no need to waste everyone's time and bandwidth with sixteen thousand words; - choose a MEANINGFUL subject line, there is no need to paste the entire body of your code in the subject line. Thank you. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
On Sun, Jan 27, 2013 at 8:07 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: That code works, but it creates links for both the URL and hits columns! Only the URL must be linked not the hits column! 1) Trim your quotes. I can't be bothered doing your trimming for you, so I'm now under-quoting. 2) Quit using Google Groups, or manually fix its brain-dead double-spacing. 3) Look into Python's formatting options and see how to solve your own problem. You'll probably want to use .format() rather than %. 4) Look into HTML entity escaping and do not publish anything to the web until you understand why what you had before was dangerous. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
On 01/26/2013 12:41 PM, Ferrous Cranus wrote: I can use triple (''') quoting so i dont have to escape special characters. Hmm. I think you missed what he was getting at. He's not talking about Python escape sequences. He's talking about HTML ones. There is a function in one of the standard library modules that does this. I think it's called html_sanitize or something. Google will find this. But i didnt understand you suggestion about the tuple. What don't you understand about it? It's basic python string formatting (well python 2.x string formatting). http://docs.python.org/2/library/stdtypes.html#string-formatting-operations A tuple is one method for passing variables into the string formatter. So if you need to display something twice, just put in two %s in the format string, and pass it the same variable twice. The dataset returns many lines and i need to transfor only the URL column Sorry i did not understood. -- http://mail.python.org/mailman/listinfo/python-list
looking for advice python
Hey I'm new to programming and I have been working on calculating miles per gallon. iv posted below what I have and constructive criticism would be wonderful. Thanks #This is a program used to calculate miles per gallon #variable used to gather miles driven string_miles = input('How many miles did you drive?') #variable used to gather the amount of gallons used string_gas = input('How many gallons of gas did you use?') #used to convert the miles input miles = int(string_miles) #used to convert the gas input gas = int(string_gas) #used to calculate mpg through division mpg = miles/gas print(float(string_miles)) print(float(string_gas)) print('Your miles per gallon is', format(mpg,'.2f')) -- http://mail.python.org/mailman/listinfo/python-list
Re: looking for advice python
On Sun, Jan 27, 2013 at 9:26 AM, twiztidtr...@gmail.com wrote: miles = int(string_miles) gas = int(string_gas) #used to calculate mpg through division mpg = miles/gas print(float(string_miles)) print(float(string_gas)) print('Your miles per gallon is', format(mpg,'.2f')) Welcome aboard! You turn your inputs into integers, then display them as floats... from the original strings. (Though I guess this is probably debugging code?) I would advise against doing this; at very least, it's confusing. I would recommend simply using floats everywhere, and thus allowing non-integer inputs: How many miles did you drive?60.9 How many gallons of gas did you use?11.9 Traceback (most recent call last): File 123.py, line 11, in module miles = int(string_miles) ValueError: invalid literal for int() with base 10: '60.9' Small additional point: It's common to put a space at the end of your prompt, to avoid the crammed look of drive?60.9. Are there any particular areas that you'd like comments on? ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: looking for advice python
On 01/26/2013 05:26 PM, twiztidtr...@gmail.com wrote: Hey I'm new to programming and I have been working on calculating miles per gallon. iv posted below what I have and constructive criticism would be wonderful. Thanks A good post for the python-tutor mailing list. If you want help with a program, the first thing you should specify is what version of Python you're using. And usually which OS you're running, but in this case it doesn't matter much. I don't see either a shebang line nor a coding line. #This is a program used to calculate miles per gallon #variable used to gather miles driven string_miles = input('How many miles did you drive?') #variable used to gather the amount of gallons used string_gas = input('How many gallons of gas did you use?') Why do you bother to have separate variables for the string versions? Why not just miles = int( input()) ? For that matter, what if the user enters a decimal value for the gallons? Perhaps you'd better use gas = float( input(yyy) ) #used to convert the miles input miles = int(string_miles) #used to convert the gas input gas = int(string_gas) #used to calculate mpg through division mpg = miles/gas This isn't portable to Python 2.x. In 2.x, it would truncate the result. print(float(string_miles)) print(float(string_gas)) print('Your miles per gallon is', format(mpg,'.2f')) What if the user enters something that isn't a valid number, either int or float? Where's the try/catch to handle it? Is this a class assignment? If not, why would you have a comment and a blank line between every line of useful code? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
On Jan 27, 8:18 am, Chris Angelico ros...@gmail.com wrote: 1) Trim your quotes. I can't be bothered doing your trimming for you, so I'm now under-quoting. 2) Quit using Google Groups, or manually fix its brain-dead double-spacing. 3) Look into Python's formatting options and see how to solve your own problem. You'll probably want to use .format() rather than %. 4) Look into HTML entity escaping and do not publish anything to the web until you understand why what you had before was dangerous. 5) Please stop writing code for his _commercial web hosting service_ for free. Notice that his next question is to ask you to modify your solution to provide _exactly_ what he wants. He has no interest in learning Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: ??????????? DOES GOG EXIST
On Jan 27, 2:41 am, BV BV bv8bv8...@gmail.com wrote: DOES GOG EXIST Yes, they've been happily selling non-DRMed games for years now: http://www.gog.com/ Highly recommended. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming - 28 hours training in New York for $3999
https://www.edx.org/courses/MITx/6.00x/2013_Spring/about Or take this course for free and buy 500 lunches. Your choice. On 26 January 2013 18:12, joao.cowperthwa...@nobleprog.us wrote: Python Programming - 28 hours training in New York for $3999 Course Outline: http://www.nobleprog.us/python-programming/training-course Course Date: 2013-03-05 09:30 - 2013-03-08 16:30 Course Price: $3999 per person, usually $4730 per person Remarks: A complimentary lunch will be provided Venue: 369 Lexington Ave New York, New York 10017 Please use the link below to book: http://be.nobleprog.us/node/add/course-booking?ce=751 Link(s) to other Courses you might be interested in: http://www.nobleprog.us/python-training-courses Thanks NobleProg LLC If you need any further information please contact us at: train...@nobleprog.us or 646 461 6132 -- http://mail.python.org/mailman/listinfo/python-list -- -- Juhani Karlsson 3D Artist/TD Talvi Digital Oy Pursimiehenkatu 29-31 b 2krs. 00150 Helsinki +358 443443088 juhani.karls...@talvi.fi www.vimeo.com/talvi -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
On Sun, Jan 27, 2013 at 10:29 AM, alex23 wuwe...@gmail.com wrote: 5) Please stop writing code for his _commercial web hosting service_ for free. You mean, stop asking us to write c.? With that edit, yes, I agree. One of the difficulties on this list is that we don't have two-dimensional people. Even our worst trolls have some redeeming features. I can't just dismiss Ferrous out of hand... ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming - 28 hours training in New York for $3999
On Sun, Jan 27, 2013 at 3:38 AM, Juhani Karlsson juhani.karls...@talvi.com wrote: Or take this course for free and buy 500 lunches. Your choice. You spend $8 on lunch? Wow, that's taking TANSTAAFL a long way... ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Ctypes can't find libc on Solaris
I'm trying to build PyPy on a Solaris 10 system (not supported by the PyPy gang). After worming around distutils' inability to use environment variables to add command line flags to gcc, I'm stuck with an error trying to locate libc: [translation:ERROR] Error: [translation:ERROR] Traceback (most recent call last): [translation:ERROR]File translate.py, line 269, in main [translation:ERROR] default_goal='compile') [translation:ERROR]File /var/tmp/pypy-pypy-07e08e9c885c/pypy/translator/driver.py, line 790, in from_targetspec [translation:ERROR] spec = target(driver, args) [translation:ERROR]File targetpypystandalone.py, line 152, in target [translation:ERROR] enable_allworkingmodules(config) [translation:ERROR]File /var/tmp/pypy-pypy-07e08e9c885c/pypy/config/pypyoption.py, line 419, in enable_allworkingmodules [translation:ERROR] config.objspace.usemodules.suggest(**dict.fromkeys(modules, True)) [translation:ERROR]File /var/tmp/pypy-pypy-07e08e9c885c/pypy/config/config.py, line 118, in suggest [translation:ERROR] self.suggestoption(name, value) [translation:ERROR]File /var/tmp/pypy-pypy-07e08e9c885c/pypy/config/config.py, line 122, in suggestoption [translation:ERROR] self.setoption(name, value, suggested) [translation:ERROR]File /var/tmp/pypy-pypy-07e08e9c885c/pypy/config/config.py, line 113, in setoption [translation:ERROR] child.setoption(self, value, who) [translation:ERROR]File /var/tmp/pypy-pypy-07e08e9c885c/pypy/config/config.py, line 311, in setoption [translation:ERROR] self._validator(toplevel) [translation:ERROR]File /var/tmp/pypy-pypy-07e08e9c885c/pypy/config/pypyoption.py, line 116, in validator [translation:ERROR] __import__(name) [translation:ERROR]File /var/tmp/pypy-pypy-07e08e9c885c/pypy/rlib/clibffi.py, line 305, in module [translation:ERROR] assert libc_name is not None, Cannot find C library, ctypes.util.find_library('c') returned None [translation:ERROR] AssertionError: Cannot find C library, ctypes.util.find_library('c') returned None [translation] start debugger... Digging into ctypes/util.py, it became apparent that it can't find libc on Solaris. If you run ctypes/util.py as a main program, it spits out some library info. On Linux: % python Python 2.7.2 (default, Oct 16 2012, 16:54:10) [GCC 4.4.6 [TWW]] on linux3 Type help, copyright, credits or license for more information. % python /opt/TWWfsw/python27/lib/python2.7/ctypes/util.py libm.so.6 libc.so.6 libbz2.so.1 CDLL 'libm.so', handle 7f6e8a72f000 at 7f6e8a62b710 CDLL 'libcrypt.so', handle 8b8fe0 at 7f6e8a62b710 libcrypt.so.1 On my Mac: % python ~/src/python/release27-maint/Lib/ctypes/util.py /usr/lib/libm.dylib /usr/lib/libc.dylib /usr/lib/libbz2.dylib CDLL 'libm.dylib', handle 8fe46704 at 3efbf0 CDLL 'libcrypto.dylib', handle 230520 at 3efbf0 CDLL 'libSystem.dylib', handle 8fe46704 at 3efbf0 CDLL 'System.framework/System', handle 8fe46704 at 3efbf0 On Solaris: % python /opt/TWWfsw/python27/lib/python2.7/ctypes/util.py None None None CDLL 'libm.so', handle fed807b8 at 82c320c CDLL 'libcrypt.so', handle feb703a8 at 82c320c None If I can't locate libc (and perhaps some other libraries), I'm not going to get any further. Has anyone encountered this problem and figured out a workaround? Thanks, Skip Montanaro -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming - 28 hours training in New York for $3999
Hah yeah! 8e is normal price here in Finland. : ) On 27 January 2013 01:57, Chris Angelico ros...@gmail.com wrote: On Sun, Jan 27, 2013 at 3:38 AM, Juhani Karlsson juhani.karls...@talvi.com wrote: Or take this course for free and buy 500 lunches. Your choice. You spend $8 on lunch? Wow, that's taking TANSTAAFL a long way... ChrisA -- http://mail.python.org/mailman/listinfo/python-list -- -- Juhani Karlsson 3D Artist/TD Talvi Digital Oy Pursimiehenkatu 29-31 b 2krs. 00150 Helsinki +358 443443088 juhani.karls...@talvi.fi www.vimeo.com/talvi -- http://mail.python.org/mailman/listinfo/python-list
Re: Ctypes can't find libc on Solaris
After worming around distutils' inability to use environment variables to add command line flags to gcc, I'm stuck with an error trying to locate libc: ... Should have poked around bugs.python.org first. This was reported, with a patch that works for me: http://bugs.python.org/issue5289 Sorry for the noise... S -- http://mail.python.org/mailman/listinfo/python-list
Re: Cancel threads after timeout
On 26Jan2013 09:48, Matt Jones matt.walker.jo...@gmail.com wrote: | It sounds like your real problem is with your SQL query... Is that part of | this problem under your control? Can you break the query into smaller, | quicker, pieces that you can run in a reasonable amount of time? Another option to investigate is whether you can ask the database itself to limit the run time of a query. Of course, that will abort the query but so does your proposed solution. Another approach might be to simply run each query regularly (with a pause between so the database is not spending its whole life running your query). Snapshot each latest result. Compute your report from the latest pair of snapshots at any given time on an independent schedule. It may not be valid for what you need, but if it is then this decouples you from the query time completely. Cheers, -- Cameron Simpson c...@zip.com.au Do not taunt Happy Fun Coder. -- http://mail.python.org/mailman/listinfo/python-list
Comparing offset-aware and offset-naive datetimes?
I have two datetimes. One is offset-naive. The other is offset-aware, but I happen to know its offset is 0 (i.e. GMT). How can I compare these? May the flies of a thousand Norwegian Blue parrots infest the armpits of whoever invented timezones. -- http://mail.python.org/mailman/listinfo/python-list
Re: doctests/unittest problem with exception
Paul wrote: Hello. I converted doctests into DocTestSuite() to use with unittest. And try it under Python 3. And, sure, I get errors with unmatched exceptions details (mismatched name of exception class: a.b.c.MyError instead of MyError). So, I have 2 questions: 1) how to turn on option IGNORE_EXCEPTION_DETAIL for all doctests in DocStestSuite (like 'optionflags' argument in doctest.testmod()) Have you tried reading the Fine Manual? If you don't have access to the Python documentation http://docs.python.org/3/library/doctest.html you can get interactive help at the interpreter. Launch the Python interactive interpreter, and then give these two commands: import doctest help(doctest.DocTestSuite) In particular, note that DocTestSuite takes a keyword argument: optionflags A set of doctest option flags expressed as an integer. So try passing optionFlags=doctest.IGNORE_EXCEPTION_DETAIL to the DocTestSuite. 2) Is a way to ignore all 'package path' of exception but not message? Something like: ---cut--- Traceback (most recent call last): ... ...MyError: 'details are not ignored!' ---cut--- see, ellipsis-prefix in MyError Have you tried it to see? Add this comment to your docstring, following the line which causes an exception: example() #doctest: +ELLIPSIS Traceback (most recent call last): ... ...MyError: 'details are not ignored!' Does that do what you expect? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Comparing offset-aware and offset-naive datetimes?
Roy Smith wrote: I have two datetimes. One is offset-naive. The other is offset-aware, but I happen to know its offset is 0 (i.e. GMT). How can I compare these? http://pytz.sourceforge.net/#localized-times-and-date-arithmetic -- ZeD -- http://mail.python.org/mailman/listinfo/python-list
Re: Comparing offset-aware and offset-naive datetimes?
Roy Smith r...@panix.com writes: I have two datetimes. One is offset-naive. The other is offset-aware, but I happen to know its offset is 0 (i.e. GMT). Do you know the timezone of the offset-naive value? Or is the above mixed up, and you mean “one is offset-aware; the other is offset-naive, but I happen to know its offset is UTC+0”? How can I compare these? Assuming you have a datetime value which is timezone-naive, and you have no way of getting its timezone, and are unwilling to guess, you can't sensibly compare that value to a datetime in a specific timezone:: import datetime import pytz timestamp_a = datetime.datetime(2012, 7, 1, 3, 45, 0) timestamp_b = datetime.datetime( ... 2012, 8, 1, 20, 15, 0, tzinfo=pytz.UTC) timestamp_a.tzinfo is None True timestamp_b.tzinfo UTC timestamp_a == timestamp_b Traceback (most recent call last): File stdin, line 1, in module TypeError: can't compare offset-naive and offset-aware datetimes So I'll assume that my interpretation about the mix-up is true, and that you actually have a situation like the following:: import datetime import pytz timestamp_a = datetime.datetime(2012, 7, 1, 3, 45, 0) timezone_for_a = pytz.UTC timestamp_b = datetime.datetime( ... 2012, 8, 1, 20, 15, 0, tzinfo=pytz.timezone(Asia/Gaza)) timestamp_a.tzinfo is None True timestamp_b.tzinfo DstTzInfo 'Asia/Gaza' EET+2:00:00 STD In which case, you can create a new timezone-aware value using the timezone-naive value and the timezone you've decided to apply:: timestamp_c = timestamp_a.replace(tzinfo=timezone_for_a) timestamp_c.tzinfo UTC timestamp_c == timestamp_b False timestamp_c timestamp_b False timestamp_c timestamp_b True May the flies of a thousand Norwegian Blue parrots infest the armpits of whoever invented timezones. Heh. I'm fine with timezones; they are a good-enough solution to allow our puny brains to speak about points in time in a reality that refuses to accommodate our prejudice that the time of day is the same everywhere on the globe. What I'm not fine with is politicians who think it's a fun game to fiddle with the specific timezone definitions with little advance notice and leave we programmers to clean up the mess they keep making. Those people are sorely in need of a nasal infestation of parrot fleas. -- \ “For every complex problem, there is a solution that is simple, | `\ neat, and wrong.” —Henry L. Mencken | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
The utter mess of current timezone definitions (was: Comparing offset-aware and offset-naive datetimes?)
Roy Smith r...@panix.com writes: but I happen to know its offset is 0 (i.e. GMT). As further fuel for your hatred: GMT is not the same thing as UTC+0, and never has been. (See the definitions of those two separate timezones for more; Wikipedia's articles are probably a good start.) May the flies of a thousand Norwegian Blue parrots infest the armpits of whoever invented timezones. Further support my position that the inventor of timezones is not to blame for the utter mess in their current implementation, if you are interested, can be found in the commentary within the Olson timezone database itself. Here is a fun article giving a “literary appreciation” of the database URL:http://blog.jonudell.net/2009/10/23/a-literary-appreciation-of-the-olsonzoneinfotz-database/. -- \ “What we usually pray to God is not that His will be done, but | `\ that He approve ours.” —Helga Bergold Gross | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: The utter mess of current timezone definitions (was: Comparing offset-aware and offset-naive datetimes?)
On Sun, Jan 27, 2013 at 4:25 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: but I happen to know its offset is 0 (i.e. GMT). As further fuel for your hatred: GMT is not the same thing as UTC+0, and never has been. (See the definitions of those two separate timezones for more; Wikipedia's articles are probably a good start.) For most people's purposes, GMT and UTC are equivalent. I tell people that my DD sessions are Sundays from 2:00 UTC to roughly 6:00-7:00 UTC, and if they treat that as GMT, they're not going to miss the session. It's a lot better than a mess of local time with DST. Timezones aren't a problem. Daylight/Summer time (or Ireland's alternative, Winter time) is. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: ??????????? DOES GOG EXIST
On 26/01/2013 18:41, BV BV wrote: DOES GOG EXIST http://www.youtube.com/watch?v=tRMmTbCXXAkfeature=related THANK YOU Did you hear about the dyslexic agnostic insomniac? He lies awake at night wondering if there is a dog. -- http://mail.python.org/mailman/listinfo/python-list
Re: Cancel threads after timeout
hyperboreean hyperbore...@nerdshack.com writes: Here's the use case I want to implement - I have to generate a report from multiple database servers. This report should be generated every 2 hours. Sometimes it happens that a query on one of the database servers takes longer than expected and impedes the generation of this report (that's right, the queries are ran sequential). What I am trying to achieve is to parallelize the queries on each database server and to be able to cancel one of them if it takes longer than X minutes. threading.Thread doesn't support this and seems that in general programming languages don't implement a way to cancel threads from the outside. And it is difficult in general. The problem lies in the interaction between Python and (unknown by Python) C extensions. Many C extensions would not work properly when simply aborted in between (loose memory, fail to release resources, leave an inconsistent state). You need something like try: ... finally: ... or try: ... except: ... to have the ability to handle asynchronous aborts - but C lacks such support. In the light of this difficulty, the Python developpers decided not to expose the possibility of many threading packages to abort a thread. I was told that their is an approximative function at the Python C interface (in Python 2, not sure whether it is also available in Python 3): a function that allows you register the wish for a thread aborting. This wish is recognized only when the thread is on Python (not C) level (thus, not applicable in your case) and it causes an exception that normally leads to the thread abortion but plays well with Python's try: ... finally: ... and try: ... except: ...: thus, the thread can properly clean up. You best approach is probably to ask the databases in parallel, wait for some time and simply ignore answers that do not arrive within that time (without any aborting trial). -- http://mail.python.org/mailman/listinfo/python-list
[issue16737] Different behaviours in script run directly and via runpy.run_module
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16737 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16748] Make CPython test package discoverable
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16748 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11995] test_pydoc loads all Python modules
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11995 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17037] Add conforms_to_pep399() to test.support
Eric Snow added the comment: The decorator also mitigates the problem described in issue #16835. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17037 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16770] Selection in IDLE often skips first character
Ned Deily added the comment: Using Cocoa Tk 8.5.13 and IDLE from either 2.7.3 and 3.3.0 on OS X 10.8.2, I can reproduce the behavior you report. However, I do not see the behavior when using Python 2.7.3 linked with the older Carbon Tk 8.4. I tried without success to reproduce the behavior using a stripped down version of one of the Tk Text widget demos in Wish 8.5. To me, the most likely cause is either an issue within Tk itself or a Tk 8.5 difference not handled by Tkinter and/or IDLE. In any case, it seems like a rather minor annoyance compared with most IDLE or Tkinter issues. If someone wants to investigate further, please feel free to do so. -- assignee: ned.deily - priority: normal - low resolution: out of date - stage: committed/rejected - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16770 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17038] multiprocessing only use one core when C module are imported
New submission from HadiM: Hi, This is the first time I report a bug so if I did something wrong please let me know. I also tried to ask on #python and #python-fr before posting here to know if it was a bug or a possible multiprocessing limitation on Linux. So I'm sorry if it's not a bug... The problem appears when a module with .c compiled file is imported (sush as numpy, scipy, pandas, tables, skimage, I did not tested with a custom .c module). Multiprocessing and more specifically imap and map method of Pool class did not distribute processes along all the core but only on one core. This problem does not appears when I don't import a module with .c compiled. I know distributing processes along cores is specific to the OS implementation and not related to Python but I said that to illustrate the behaviour. I should notice that I did not see the bug with a Windows 7, 32 bits (Virtualbox). My laptop run with the latest ubuntu 64bits (tested with both kernel 3.5 and 3.8 last rc). It's a classic Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz with 4 cores. You can try to reproduce the bug with the attached file. You can also find the same file here : http://pastebin.com/jqq9G5Ph Thank you for your time ! -- components: Library (Lib), ctypes files: bug.py messages: 180648 nosy: hadim priority: normal severity: normal status: open title: multiprocessing only use one core when C module are imported type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file28841/bug.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17038 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13454] crash when deleting one pair from tee()
Roundup Robot added the comment: New changeset 4ee8d38398d4 by Serhiy Storchaka in branch '2.7': Optimize the test for issue #13454. http://hg.python.org/cpython/rev/4ee8d38398d4 New changeset d391b2849a51 by Serhiy Storchaka in branch '3.2': Optimize the test for issue #13454. http://hg.python.org/cpython/rev/d391b2849a51 New changeset 2258b4d89c9f by Serhiy Storchaka in branch '3.3': Optimize the test for issue #13454. http://hg.python.org/cpython/rev/2258b4d89c9f New changeset 1f57fb5e1e8e by Serhiy Storchaka in branch 'default': Optimize the test for issue #13454. http://hg.python.org/cpython/rev/1f57fb5e1e8e -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17038] multiprocessing only use one core when C module are imported
HadiM added the comment: I test to launch bug.py with pypy (import numpypy instead of import numpy) and the bug did not appear. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17038 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1145257] shutil.copystat() may fail...
Neil Muller added the comment: I can't reproduce this bug on windows XP or windows 7 with python 2.7 or python 3.3. Is this still an issue? -- nosy: +Neil Muller ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1145257 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10156] Initialization of globals in unicodeobject.c
Roundup Robot added the comment: New changeset 7c8ad0d02664 by Serhiy Storchaka in branch '2.7': Issue #10156: In the interpreter's initialization phase, unicode globals http://hg.python.org/cpython/rev/7c8ad0d02664 New changeset f7eda8165e6f by Serhiy Storchaka in branch '3.2': Issue #10156: In the interpreter's initialization phase, unicode globals http://hg.python.org/cpython/rev/f7eda8165e6f New changeset 01d4dd412581 by Serhiy Storchaka in branch '3.3': Issue #10156: In the interpreter's initialization phase, unicode globals http://hg.python.org/cpython/rev/01d4dd412581 New changeset cb12d642eed2 by Serhiy Storchaka in branch 'default': Issue #10156: In the interpreter's initialization phase, unicode globals http://hg.python.org/cpython/rev/cb12d642eed2 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17034] Initialization of globals in stringobject.c and bytesobject.c
Serhiy Storchaka added the comment: And for bytesobject.c in 3.x. -- title: Initialization of globals in stringobject.c - Initialization of globals in stringobject.c and bytesobject.c versions: +Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file28842/bytes_globals.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17034 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10156] Initialization of globals in unicodeobject.c
Serhiy Storchaka added the comment: Committed. Thank you for review, Stefan. Close this issue if the work is finished. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16235] Add python-config.sh for use during cross compilation.
Roundup Robot added the comment: New changeset c0370730b364 by doko in branch 'default': - Issue #16235: Implement python-config as a shell script. http://hg.python.org/cpython/rev/c0370730b364 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16235 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16235] Add python-config.sh for use during cross compilation.
Matthias Klose added the comment: now committed, using stdin for sed. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16235 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16235] Add python-config.sh for use during cross compilation.
Ray Donnelly added the comment: Thank you Matthias! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16235 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15484] CROSS: use _PYTHON_PROJECT_BASE in distutils sysconfig
Roundup Robot added the comment: New changeset f0cde9b6830a by doko in branch '3.3': - Follow-up for issue #15484: In PYTHON_FOR_BUILD, use $(PLATDIR) instead http://hg.python.org/cpython/rev/f0cde9b6830a New changeset 938a045cfe7d by doko in branch 'default': - Follow-up for issue #15484: In PYTHON_FOR_BUILD, use $(PLATDIR) instead http://hg.python.org/cpython/rev/938a045cfe7d -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15484 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17038] multiprocessing only use one core when C module are imported
Charles-François Natali added the comment: Hello, So I'm sorry if it's not a bug... Don't be afraid, we don't byte :-) Concerning your problem, my guess would be that one of the modules you import sets the process CPU affinity (maybe as a workaround to mitigate the GIL impact in multi-threaded code, or whatever) upon import. And a quick google search returns this: https://github.com/ipython/ipython/issues/840 To confirm this, you can just do: strace -e sched_setaffinity python -c import numpy You can also add for line in open('/proc/self/status'): if 'Cpu' in line: print(line) Right before and after importing the module, and you'll see that the CPU affinity has changed. -- nosy: +neologix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17038 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17039] socket.SocketIO hides socket timeouts as blocking errors
New submission from Ronny Pfannschmidt: the change to conform with pep 3114 makes socketSocketIO hide Timeouts, since they are also denoted with EAGAIN (which is one of the blocking errors a nonblocking socket will raise) that causes read/readinto return None, when one would expect a Timeout -- messages: 180660 nosy: Ronny.Pfannschmidt priority: normal severity: normal status: open title: socket.SocketIO hides socket timeouts as blocking errors versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17039 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17038] multiprocessing only use one core when C module are imported
HadiM added the comment: Indeed some value change when I print cpu line from /proc/self/status but I don't really understand what that mean... So there is no solution about that ? We cannot use multiprocessing with these modules under Linux ? Do you think I can manually change the CPU affinity or at least block changes made by other modules (without recompiling them of course) ? I guess if it's possible to modify CPU affinity, numpy and other scientific libraries won't be efficient as before, no ? Because the won't share the same cache or something like that, if I get the wikipedia page about cpu affinity. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17038 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3871] cross and native build of python for mingw* hosts
Ray Donnelly added the comment: When I say “our patches” I mean mine and Alexey Pavlov’s jointly maintained patch-set. I hope you don’t mind that I find you saying: I tried some of these patches, but they aren't very organinzed. I really need some docemntaiton to better understand what each patch does and which pairs go together and which don't. ...and then continuing to present a single uber-patch to be mildly funny/ironic? You've already accepted that you should split them up and remove the needless formatting changes to make them more reviewable so I won't labour on this point. ctypes bz2 multiprocessing sqlite3 ssl pyexpat zlib Likewise for ours, but also curses, curses_panel, readline, TKinter, IDLE (and probably more besides) for both Win32, Win64, Mac OS X 32bit and 64bit. The main idea behind our patches is (mostly in common with all patches) that they: 1. Are as atomic as possible in their operation (which as few interdependencies as necessary). 2. Are applied in an obvious ordering. 3. Are named sensibly according to what they do. 4. Build upon - and can reuse updates to - Roumen's uber-patch (and also clean it up a bit; let’s face it Roumen did a lot of the hard work and everyone else is trying to finish it off so we can build releases from it). 5. Enable comprehensive cross-compilation. Given the name of each patch and the fact that they do one thing (the novel ones at least) and that by-and-large they fit on a few screens, I had hoped that they were usefully descriptive. To explain which ones go together: The numbering skips 5 each time for each independent bug-fix or feature - to allow space for later, related modifications. Therefore, where the numbering changes monotonically, the patches are related. This only happens twice, once to address the problem caused by Roumen providing an uber-patch and once due to a block of fixes all related to curses (ncurses and PDCurses are both supported). I assume my addressing of Roumen's uber-patch is what led you to write: However, I'm noticing a ton of descrepancies with these patches. Some are removing pthreads, others are adding them back. There is logic to what you describe as a ton of discrepancies: Roumen's patch is included in it's entirety as 0030-py3k-20121004-MINGW.patch, then I remove one feature of that patch that needed fixing (threading changes) with 0031-py3k-20121004-MINGW-removal-of-pthread-patch.patch, then I add a patch that provides my newer fix, 0032-py3k-20121004-MINGW-ntthreads.patch. The exact same thing happens with the libffi changes. The pthreads stuff needs fixing due to libwinpthread in MinGW-w64 and libffi is broken when targetting a 64bit Windows host. My reason for doing this is so that I can directly drop updated versions from Roumen in over 0030 and it will (in theory at least) still work. He can continue to use a uber-patch if he wishes (though I don't think he does this for new patches). Also by taking this approach, my patch for the threading issues has no dependencies at all on Roumen’s patch, since a previous patch “handled” the dependency by removing that part of it. Everything you said about build environment and the test-suite I agree with. My crucifixion-freedom project includes a .vbs to setup the most basic MSYS and MinGW-w64 environment: https://raw.github.com/mingwandroid/crucifixion-freedom/master/scripts/windows/BootstrapMinGW64.vbs ...this is essential to prevent spending time chasing down issues due to discrepancies between build environments. However, we must go further and add that the patches *cannot* break any other native or cross-compilation, which - as I think Matthias is alluding to - is probably not the case with your patch. This issue is called cross and native build of python for mingw* hosts, so that your patch possibly breaks builds on build-machine is unfortunate (especially so as a build-machine Python is required to run setup.py as part of the cross-build procedure). Even if it doesn't break building for the build-machine it breaks building the cross-MinGW-w64. Each occurrence of /mingw in your patch is probably a part of this problem (you can’t expect cross build systems to be be able to be rooted to /mingw, often you’ll find ~/mingw or /tmp/mingw) You said, It seems some are also compiling and using the mingw version outside of the msys shell, which I'm not certain of the advantages there when u can just use the mscv version, I’m not entirely sure what you mean here; if compiling MinGW Python on a Windows system with my patches, MSYS is 100% a requirement (cmd.exe will never run the configure script). I can only guess this relates to the mingw_posix2win_path stuff in your patch. Forgive me if I’m wrong, but it seems that you are conflating MSYS and MinGW when they are not related (except by frequent proximity). Without wanting to point out the obvious, MinGW-w64 is a sysroot and compiler toolchain for making
[issue17038] multiprocessing only use one core when C module are imported
Charles-François Natali added the comment: Indeed some value change when I print cpu line from /proc/self/status but I don't really understand what that mean... It means that the CPU affinity is changed, so the scheduler binds your process to a subset of the available CPUs. So there is no solution about that ? We cannot use multiprocessing with these modules under Linux ? Do you think I can manually change the CPU affinity or at least block changes made by other modules (without recompiling them of course) ? If you don't want to recompile the offending module (it seems to be GotoBLAS2), you can change the affinity after importing your modules with something like: os.system(taskset -p 0xff %d % os.getpid()) (Python 3.3 exposes the scheduling API natively, see http://docs.python.org/dev/library/os.html#interface-to-the-scheduler) I guess if it's possible to modify CPU affinity, numpy and other scientific libraries won't be efficient as before, no ? Because the won't share the same cache or something like that, if I get the wikipedia page about cpu affinity. Soft affinity is naturally done by the operating system scheduler, so you don't have to worry about cache line bouncing and the like. Hard affinity is only useful in very specific cases. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17038 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17038] multiprocessing only use one core when C module are imported
Changes by Charles-François Natali cf.nat...@gmail.com: -- resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17038 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17038] multiprocessing only use one core when C module are imported
HadiM added the comment: Your snippet did the trick ! Thank you for your time. Even if it's not very clean, it's working. Thank again ! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17038 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17010] Windows launcher ignores active virtual environment
Vinay Sajip added the comment: When using an activated virtual environment, there is no need to use py - just use python. Primarily, the launcher looks for a shebang line in a script to determine which interpreter to use for the script. If no shebang line can be found, it will launch the default Python, which is currently the most recent Python 2.x found in the registry. When invoked via py -3 (or with suitable settings in the configuration), it will use the most recent Python 3.x found in the registry. Since venv interpreters are not in the registry, they will never be invoked as the default Python. However, any scripts installed into venvs will have the correct shebang lines, so they will launch with the venv's interpreter. I don't believe this is a bug, as the system is IMO working as designed and as per PEP 397. If the launcher is asked to launch a script which contains a shebang, while a venv is activated, it will run with the interpreter indicated by the shebang, rather than the venv's interpreter. Perhaps one could consider an enhancement whereby if no shebang is found, a different approach is used to find the interpreter - e.g. looking for python on the path before looking in the registry to locate an interpreter. The question arises as to whether this should be tied to a specific condition such as the presence of an environment key PYLAUNCHER_USEPATH. (This is of course orthogonal to whether or not a venv is activated, but would have the desired effect when a venv is activated, without needing to tie the launcher to a virtualenv-specific environment value such as VIRTUAL_ENV.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17010 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17039] socket.SocketIO hides socket timeouts as blocking errors
Ronny Pfannschmidt added the comment: noticed an error in my testing, sorry for the noise -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17039 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17040] Document context manager support for shelf objects
New submission from Berker Peksag: Context manager support for shelf objects was added in issue 13896, but not documented. -- assignee: docs@python components: Documentation files: shelve-context-manager-doc.diff keywords: patch messages: 180667 nosy: asvetlov, berker.peksag, docs@python priority: normal severity: normal status: open title: Document context manager support for shelf objects versions: Python 3.4 Added file: http://bugs.python.org/file28843/shelve-context-manager-doc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17040 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17041] Fix tests for build --without-doc-strings
New submission from Serhiy Storchaka: Some tests failed when Python built without docstrings (--without-doc-strings options). Proposed patch fixes most of tests. Only doctests in test_generators and test_genexps don't fixed. I don't know how to make doctests conditional. [135/372] test_generators ** File /home/serhiy/py/cpython-without-doc-strings/Lib/test/test_generators.py, line ?, in test.test_generators.__test__.email Failed example: print(i.__next__.__doc__) Expected: x.__next__() == next(x) Got: BLANKLINE ** 1 items had failures: 1 of 31 in test.test_generators.__test__.email ***Test Failed*** 1 failures. test test_generators failed -- 1 of 287 doctests failed [137/372/1] test_genexps ** File /home/serhiy/py/cpython-without-doc-strings/Lib/test/test_genexps.py, line ?, in test.test_genexps.__test__.doctests Failed example: print(g.__next__.__doc__) Expected: x.__next__() == next(x) Got: BLANKLINE ** 1 items had failures: 1 of 75 in test.test_genexps.__test__.doctests ***Test Failed*** 1 failures. test test_genexps failed -- 1 of 75 doctests failed -- components: Tests files: tests_without_docstrings.patch keywords: patch messages: 180668 nosy: serhiy.storchaka, skrah priority: normal severity: normal stage: patch review status: open title: Fix tests for build --without-doc-strings type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file28844/tests_without_docstrings.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17041 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17041] Fix tests for build --without-doc-strings
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +ezio.melotti, michael.foord, pitrou Added file: http://bugs.python.org/file28845/tests_without_docstrings-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17041 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16817] test___all__ affects other tests by doing too much importing
Eli Bendersky added the comment: Eric, yes the key code in test_xml_etree that handles this is: def pickleRoundTrip(self, obj, name, dumper, loader): save_m = sys.modules[name] try: sys.modules[name] = dumper temp = pickle.dumps(obj) sys.modules[name] = loader result = pickle.loads(temp) except pickle.PicklingError as pe: # pyET must be second, because pyET may be (equal to) ET. human = dict([(ET, cET), (pyET, pyET)]) raise support.TestFailed(Failed to round-trip %r from %r to %r % (obj, human.get(dumper, dumper), human.get(loader, loader))) from pe finally: sys.modules[name] = save_m return result Because pickle does its own import of ElementTree. The test___all__ problem should be solved by a patch to issue #1674555, but having a separate mechanism in test.support was discussed. I'll take a look at your decorator. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17041] Fix tests for build --without-doc-strings
Stefan Krah added the comment: I've already committed a decorator in 5c7f92bfe785, but it isn't quite robust. I think the one in issue17041-decorator.diff should do the trick. Also, we then can use support.HAVE_DOCSTRINGS for some doctests. -- Added file: http://bugs.python.org/file28846/issue17041-decorator.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17041 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15359] Sockets support for CAN_BCM
Charles-François Natali added the comment: I've added (some) docs and added checking of the BCM constants to the test_socket module. This version looks good to me. I'll commit it next week (I currently don't have access to my development machine). I would guess that checking each broadcast manager function provided by the kernel isn't required? No, the goal is not to test the kernel implementation. That should be enough for now. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15359 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17037] Add conforms_to_pep399() to test.support
Eli Bendersky added the comment: Nice work, although I worry this is starting to get into too much magic territory. Do you have a real use case for the 'names' argument? -- nosy: +eli.bendersky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17037 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17037] Add conforms_to_pep399() to test.support
Antoine Pitrou added the comment: I'm not sure what the use case for this is. It looks more obfuscating than revealing to me. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17037 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17041] Fix tests for build --without-doc-strings
Serhiy Storchaka added the comment: Oh, I see Stefan already fixed some failures. Here are updated patches. -- Added file: http://bugs.python.org/file28847/tests_without_docstrings-2.7_2.patch Added file: http://bugs.python.org/file28848/tests_without_docstrings-3.2_2.patch Added file: http://bugs.python.org/file28849/tests_without_docstrings-3.3_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17041 ___diff -r 523f309cf558 Lib/ctypes/test/test_win32.py --- a/Lib/ctypes/test/test_win32.py Sat Jan 26 13:31:44 2013 +0100 +++ b/Lib/ctypes/test/test_win32.py Sat Jan 26 16:19:23 2013 +0200 @@ -3,6 +3,7 @@ from ctypes import * from ctypes.test import is_resource_enabled import unittest, sys +import sysconfig import _ctypes_test @@ -60,7 +61,9 @@ def test_COMError(self): from _ctypes import COMError -self.assertEqual(COMError.__doc__, Raised when a COM method call failed.) +if sysconfig.get_config_var('WITH_DOC_STRINGS'): +self.assertEqual(COMError.__doc__, + Raised when a COM method call failed.) ex = COMError(-1, text, (details,)) self.assertEqual(ex.hresult, -1) diff -r 523f309cf558 Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py Sat Jan 26 13:31:44 2013 +0100 +++ b/Lib/distutils/tests/test_build_ext.py Sat Jan 26 16:19:23 2013 +0200 @@ -2,6 +2,7 @@ import os from StringIO import StringIO import textwrap +import sysconfig from distutils.core import Extension, Distribution from distutils.command.build_ext import build_ext @@ -77,8 +78,9 @@ self.assertEqual(xx.foo(2, 5), 7) self.assertEqual(xx.foo(13,15), 28) self.assertEqual(xx.new().demo(), None) -doc = 'This is a template module just for instruction.' -self.assertEqual(xx.__doc__, doc) +if sysconfig.get_config_var('WITH_DOC_STRINGS'): +doc = 'This is a template module just for instruction.' +self.assertEqual(xx.__doc__, doc) self.assertTrue(isinstance(xx.Null(), xx.Null)) self.assertTrue(isinstance(xx.Str(), xx.Str)) diff -r 523f309cf558 Lib/test/test_functools.py --- a/Lib/test/test_functools.pySat Jan 26 13:31:44 2013 +0100 +++ b/Lib/test/test_functools.pySat Jan 26 16:19:23 2013 +0200 @@ -196,6 +196,7 @@ self.assertEqual(wrapper.__name__, 'f') self.assertEqual(wrapper.attr, 'This is also a test') +@test_support.requires_docstrings @unittest.skipIf(sys.flags.optimize = 2, Docstrings are omitted with -O2 and above) def test_default_update_doc(self): diff -r 523f309cf558 Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.pySat Jan 26 13:31:44 2013 +0100 +++ b/Lib/test/test_pydoc.pySat Jan 26 16:19:23 2013 +0200 @@ -10,12 +10,21 @@ import xml.etree import test.test_support from collections import namedtuple +import sysconfig from test.script_helper import assert_python_ok from test.test_support import ( TESTFN, rmtree, reap_children, captured_stdout) from test import pydoc_mod +if sysconfig.get_config_var('WITH_DOC_STRINGS'): +expected_data_docstrings = ( +'dictionary for instance variables (if defined)', +'list of weak references to the object (if defined)', +) +else: +expected_data_docstrings = ('', '', '', '') + expected_text_pattern = \ NAME @@ -40,11 +49,9 @@ class B(__builtin__.object) | Data descriptors defined here: |\x20\x20 - | __dict__ - | dictionary for instance variables (if defined) + | __dict__%s |\x20\x20 - | __weakref__ - | list of weak references to the object (if defined) + | __weakref__%s |\x20\x20 | -- | Data and other attributes defined here: @@ -75,6 +82,9 @@ Nobody .strip() +expected_text_data_docstrings = tuple('\n | ' + s if s else '' + for s in expected_data_docstrings) + expected_html_pattern = \ table width=100%% cellspacing=0 cellpadding=2 border=0 summary=heading @@ -121,10 +131,10 @@ trtd bgcolor=#ffc8d8ttnbsp;nbsp;nbsp;/tt/tdtdnbsp;/td td width=100%%Data descriptors defined here:br dldtstrong__dict__/strong/dt -ddttdictionarynbsp;fornbsp;instancenbsp;variablesnbsp;(ifnbsp;defined)/tt/dd +ddtt%s/tt/dd /dl dldtstrong__weakref__/strong/dt -ddttlistnbsp;ofnbsp;weaknbsp;referencesnbsp;tonbsp;thenbsp;objectnbsp;(ifnbsp;defined)/tt/dd +ddtt%s/tt/dd /dl hr Data and other attributes defined here:br @@ -168,6 +178,8 @@ td width=100%%Nobody/td/tr/table .strip() +expected_html_data_docstrings = tuple(s.replace(' ', 'nbsp;') + for s in expected_data_docstrings) #
[issue17037] Add conforms_to_pep399() to test.support
Eli Bendersky added the comment: Antoine - I think I can see the use case. ATM, to conform to PEP399, every test _class_ has to be subclassed twice with appropriate assignment to the relevant tested class. This leads to a lot of repetition. As an example, see test_decimal.py, which does this a lot. It would be nice to save programmers from this repetition; however, as I said before, this solution seems very complex. Maybe simpler solutions can be conceived? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17037 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17037] Add conforms_to_pep399() to test.support
Antoine Pitrou added the comment: I'm not sure how the lots of repetition is a problem. The following: class CCoverage(Coverage): decimal = C class PyCoverage(Coverage): decimal = P is quite trivial compared to the actual base test case (the Coverage class). Not only it is quite trivial to *write*, but it is also very easy to *read*, and quite explicit. Python is not Lisp, and we do not like meta-programming that much, when it tends to obscure the code in the name of not repeating yourself. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17037 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17041] Fix tests for build --without-doc-strings
R. David Murray added the comment: Once upon a time (two years ago?) we fixed the tests so that they ran successfully (skipped when appropriate) with -OO set, which omits docstrings. We were checking for the optimization level (sys.flags.optimize) then. It seems like it would make more sense to combine both checks into one decorator. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17041 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17041] Fix tests for build --without-doc-strings
Serhiy Storchaka added the comment: Patches updated incorporating Stefan's patch. -- Added file: http://bugs.python.org/file28850/tests_without_docstrings-2.7_3.patch Added file: http://bugs.python.org/file28851/tests_without_docstrings-3.2_3.patch Added file: http://bugs.python.org/file28852/tests_without_docstrings-3.3_3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17041 ___diff -r 523f309cf558 Lib/ctypes/test/test_win32.py --- a/Lib/ctypes/test/test_win32.py Sat Jan 26 13:31:44 2013 +0100 +++ b/Lib/ctypes/test/test_win32.py Sat Jan 26 16:59:23 2013 +0200 @@ -3,6 +3,7 @@ from ctypes import * from ctypes.test import is_resource_enabled import unittest, sys +from test import test_support as support import _ctypes_test @@ -60,7 +61,9 @@ def test_COMError(self): from _ctypes import COMError -self.assertEqual(COMError.__doc__, Raised when a COM method call failed.) +if support.HAVE_DOCSTRINGS: +self.assertEqual(COMError.__doc__, +Raised when a COM method call failed.) ex = COMError(-1, text, (details,)) self.assertEqual(ex.hresult, -1) diff -r 523f309cf558 Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py Sat Jan 26 13:31:44 2013 +0100 +++ b/Lib/distutils/tests/test_build_ext.py Sat Jan 26 16:59:23 2013 +0200 @@ -77,8 +77,9 @@ self.assertEqual(xx.foo(2, 5), 7) self.assertEqual(xx.foo(13,15), 28) self.assertEqual(xx.new().demo(), None) -doc = 'This is a template module just for instruction.' -self.assertEqual(xx.__doc__, doc) +if test_support.HAVE_DOCSTRINGS: +doc = 'This is a template module just for instruction.' +self.assertEqual(xx.__doc__, doc) self.assertTrue(isinstance(xx.Null(), xx.Null)) self.assertTrue(isinstance(xx.Str(), xx.Str)) diff -r 523f309cf558 Lib/test/test_functools.py --- a/Lib/test/test_functools.pySat Jan 26 13:31:44 2013 +0100 +++ b/Lib/test/test_functools.pySat Jan 26 16:59:23 2013 +0200 @@ -196,6 +196,7 @@ self.assertEqual(wrapper.__name__, 'f') self.assertEqual(wrapper.attr, 'This is also a test') +@test_support.requires_docstrings @unittest.skipIf(sys.flags.optimize = 2, Docstrings are omitted with -O2 and above) def test_default_update_doc(self): diff -r 523f309cf558 Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.pySat Jan 26 13:31:44 2013 +0100 +++ b/Lib/test/test_pydoc.pySat Jan 26 16:59:23 2013 +0200 @@ -10,12 +10,21 @@ import xml.etree import test.test_support from collections import namedtuple +import sysconfig from test.script_helper import assert_python_ok from test.test_support import ( TESTFN, rmtree, reap_children, captured_stdout) from test import pydoc_mod +if test.test_support.HAVE_DOCSTRINGS: +expected_data_docstrings = ( +'dictionary for instance variables (if defined)', +'list of weak references to the object (if defined)', +) +else: +expected_data_docstrings = ('', '', '', '') + expected_text_pattern = \ NAME @@ -40,11 +49,9 @@ class B(__builtin__.object) | Data descriptors defined here: |\x20\x20 - | __dict__ - | dictionary for instance variables (if defined) + | __dict__%s |\x20\x20 - | __weakref__ - | list of weak references to the object (if defined) + | __weakref__%s |\x20\x20 | -- | Data and other attributes defined here: @@ -75,6 +82,9 @@ Nobody .strip() +expected_text_data_docstrings = tuple('\n | ' + s if s else '' + for s in expected_data_docstrings) + expected_html_pattern = \ table width=100%% cellspacing=0 cellpadding=2 border=0 summary=heading @@ -121,10 +131,10 @@ trtd bgcolor=#ffc8d8ttnbsp;nbsp;nbsp;/tt/tdtdnbsp;/td td width=100%%Data descriptors defined here:br dldtstrong__dict__/strong/dt -ddttdictionarynbsp;fornbsp;instancenbsp;variablesnbsp;(ifnbsp;defined)/tt/dd +ddtt%s/tt/dd /dl dldtstrong__weakref__/strong/dt -ddttlistnbsp;ofnbsp;weaknbsp;referencesnbsp;tonbsp;thenbsp;objectnbsp;(ifnbsp;defined)/tt/dd +ddtt%s/tt/dd /dl hr Data and other attributes defined here:br @@ -168,6 +178,8 @@ td width=100%%Nobody/td/tr/table .strip() +expected_html_data_docstrings = tuple(s.replace(' ', 'nbsp;') + for s in expected_data_docstrings) # output pattern for missing module missing_pattern = no Python documentation found for '%s' @@ -229,7 +241,9 @@ mod_url = nturl2path.pathname2url(mod_file) else: mod_url = mod_file -expected_html =
[issue17041] Fix tests for build --without-doc-strings
Serhiy Storchaka added the comment: It seems like it would make more sense to combine both checks into one decorator. These are different cases. @unittest.skipIf(sys.flags.optimize = 2) is about docstrings in Python implemented modules, and @support.requires_docstrings is about docstrings in C implemented modules. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17041 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12397] re match object methods have no docstrings
Serhiy Storchaka added the comment: Fixed in issue16443. -- nosy: +serhiy.storchaka resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - Add docstrings to regular expression match objects ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12397 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15731] Mechanism for inheriting docstrings and signatures
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15731 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17009] Thread Programming With Python should be removed
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17009 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6972] zipfile.ZipFile overwrites files outside destination path
Serhiy Storchaka added the comment: Can anyone review the patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6972 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16991] Add OrderedDict written in C
Ezio Melotti added the comment: What's the reason for moving the OrderedDict tests in a separate file? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4844] ZipFile doesn't range check in _EndRecData()
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file28178/zipfile_unpack_check.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4844 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16996] Reuse shutil.which() in webbrowser module
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16996 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4844] ZipFile doesn't range check in _EndRecData()
Serhiy Storchaka added the comment: Patch updated. Now the test use io.BytesIO() for input too. A loop limit changed from len() -2 to len(). If there are no objections I'll commit this patch next week. -- assignee: mcherm - serhiy.storchaka Added file: http://bugs.python.org/file28853/zipfile_unpack_check.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4844 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3718] environment variable MACHDEP and python build system
Roumen Petrov added the comment: Matthias Klose wrote: Matthias Klose added the comment: the change to the configure script looks ok. however you could change the README too. This is 5 years old issue. README is not more in repository. As result python lack documentation related to build process. It looks like the changes to the Makefile.pre.in are already applied. No . But you could ignore this part of issue. Roumen -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3718 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17037] Add conforms_to_pep399() to test.support
Eric Snow added the comment: In my case I've been doing PEP 399 for collections.OrderedDict. It struck me that the boilerplate could be stowed away in a decorator. It's more than just adding a couple subclasses. Here's what it covers: * add the test case subclasses, * make sure the original test case does not get used (#16835), * use the relevant names as class attributes rather than globals (e.g. self.OrderedDict vs. OrderedDict), * hack around modules that do their own imports (#16817), * others(?). When adapting existing test cases having a decorator to do this makes the job a snap without having to worry about corner cases. You have to add the decorator and then add the new test names to the test discovery code (at least until we use unittest's test discovery). For new test cases and splitting out test cases it likewise simplifies things. On top of that, if you drop the decorator the test case would still run as-is. Other benefits for both new and existing test cases: * the decorator makes it clear what is going on (or will be made to) via the decorator name, * the requisite boilerplate doesn't have to clutter up the code, * when something like #16817 or #16835 comes up, it's much easier to update the decorator in test.support instead of finding each of the PEP-399-ized tests that is affected and updating them individually. Downsides: * explicit is better than implicit, * relatedly, the solution is more magic/obfuscated that the current boilerplate. You could argue that the magnitude of the problem doesn't warrant a complex decorator, but it doesn't have to be hard to understand. My patch is something I threw together late last night that could certainly be made more clear. More importantly, as more modules get a dual implementation, the above benefits of the decorator become more pronounced. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17037 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17037] Add conforms_to_pep399() to test.support
Eric Snow added the comment: Do you have a real use case for the 'names' argument? My use case was with the tests for OrderedDict. The existing tests don't refer to collections.OrderedDict, but rather to OrderedDict (looked up from the globals). The names argument facilitates the replacement of OrderedDict. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17037 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17041] Fix tests for build --without-doc-strings
Stefan Krah added the comment: Serhiy Storchaka rep...@bugs.python.org wrote: It seems like it would make more sense to combine both checks into one decorator. These are different cases. @unittest.skipIf(sys.flags.optimize = 2) is about docstrings in Python implemented modules, and @support.requires_docstrings is about docstrings in C implemented modules. But they're always used together, aren't they? I kind of like the idea of a single decorator. We could have two different messages compiled without docstrings and docstrings are omitted with -O2 and above, where the first message should get priority if both conditions are true. Given the mood on python-dev concerning --without-doc-strings, I wonder if we should stick to minimal changes and just skip the tests in test_pydoc.py instead of fixing them. Personally I'm happy either way. David, what do you think? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17041 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17003] Unification of read() and readline() argument names
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17003 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16991] Add OrderedDict written in C
Eric Snow added the comment: What's the reason for moving the OrderedDict tests in a separate file? Following the precedent of collections.deque and collections.defaultdict: * a big chunk of code * the default implementation will be coming via _collections. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17005] Add a topological sort algorithm
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17005 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16968] Fix test discovery for test_concurrent_futures.py
Chris Jerdonek added the comment: Okay, I think I understand the issue better now. The threading._dangling warning happens because when leaving the saved_test_environment context manager in regrtest: http://hg.python.org/cpython/file/fcdb35b114ab/Lib/test/regrtest.py#l1271 the context manager finds threads still in threading._dangling that weren't there at the beginning. I think the threads are still in there because the tests variable in the code linked to above is holding references to those threads (which isn't surprising given what test_concurrent_futures.py tests). So this is preventing the threads (which are in a WeakSet) from being garbage collected. On my machine, severing those references before leaving the context manager solves the problem. You can do this by adding test = 0 after the test_runner() line, or defining tests inside an inner function as follows: if test_runner is None: def test_runner(): tests = unittest.TestLoader().loadTestsFromModule(the_module) support.run_unittest(tests) test_runner() To be completely sure, we may also need to do something to ensure that the threads are garbage collected before leaving the context manager. Currently, an explicit call to support.gc_collect() happens in threading_cleanup() (which is in turn called by reap_threads(), etc): http://hg.python.org/cpython/file/fcdb35b114ab/Lib/test/support.py#l1665 But I'm not sure if that's late enough in the process to guarantee garbage collection of those threads with the test_runner() change above (since the tests list might still be defined). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16968 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3718] environment variable MACHDEP and python build system
Changes by Gregory P. Smith g...@krypto.org: -- nosy: -gregory.p.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3718 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16991] Add OrderedDict written in C
Ezio Melotti added the comment: These are indeed good reasons. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10740] sqlite3 module should allow DDL statements in transactions
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10740 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15483] CROSS: initialise include and library paths in setup.py
Roumen Petrov added the comment: Matthias Klose added the comment: I don't think this one is still necessary. can it be closed? If is difficult to confirm. In scope of issue title initialization is fixed. Another part of proposed path is to insert at first position current directory if cross build. If this is not acceptable in scope of this then someone could open a new issue to set unconditionally in BLDLIBRARY current directory, i.e. to change configure script. I don't like to touch existing native build so in scope of cross build this patch propose libdir to start with current. Roumen -- Added file: http://bugs.python.org/file28854/0004-CROSS-initialise-include-and-library-paths.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15483 ___From 9fe8bd2e63ad383c795962cea3aa1ff11b493988 Mon Sep 17 00:00:00 2001 From: Roumen Petrov lo...@example.net Date: Mon, 23 Jul 2012 23:31:20 +0300 Subject: [PATCH 04/13] CROSS-initialise include and library paths --- setup.py | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 5d38d29..4a27ba7 100644 --- a/setup.py +++ b/setup.py @@ -500,15 +500,16 @@ class PyBuildExt(build_ext): # lib_dirs and inc_dirs are used to search for files; # if a file is found in one of those directories, it can # be assumed that no additional -I,-L directives are needed. +lib_dirs = self.compiler.library_dirs +inc_dirs = self.compiler.include_dirs if not cross_compiling: -lib_dirs = self.compiler.library_dirs + [ +lib_dirs += [ '/lib64', '/usr/lib64', '/lib', '/usr/lib', ] -inc_dirs = self.compiler.include_dirs + ['/usr/include'] +inc_dirs += ['/usr/include'] else: -lib_dirs = self.compiler.library_dirs[:] -inc_dirs = self.compiler.include_dirs[:] +self.compiler.library_dirs.insert(0, '.') exts = [] missing = [] -- 1.7.12.1 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com