Re: Documentation bugs in 3.1 - C-API - TypeObjects
This cannot work, because Foo_Type is no PyObject but a PyVarObject (independent of the use of PyVarObject_HEAD_INIT or PyObject_HEAD_INIT). The code line would work so: ((PyObject *)Foo_Type)-ob_type = PyType_Type However, this is not what you should use. Instead, use Py_Type(Foo_Type) = PyType_Type If the type is not subtypable (doesn’t have the Py_TPFLAGS_BASETYPE flag bit set), it is permissible to call the object deallocator directly instead of via tp_free. What ? Where do we call these methods ? You should typically call tp_free inside of tp_dealloc. For example, string_dealloc ends with Py_TYPE(op)-tp_free(op); In the specific case (Py_TYPE(op) is not subtypeable), you could alternatively also call PyObject_Del(op); If there are subclasses, they might have used a different allocator (rather than the object allocator), hence you must call the deallocator through tp_free. HTH, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: A terminators' club for clp
Paul Rubin wrote: Terry Reedy tjre...@udel.edu writes: To post from g.c.p.g, one must use a real email address and respond once to an email sent to that address. So, the only reason to use c.l.p is if one wants to post anonymously, like the spammers do ;-). No I don't think so. Unwilling to disclose email address or enroll yet another computer account is not the same as anonymous. There is no 'enrolling' except for hitting reply to an email *when you first post*, but never to just read. You point your news reader to gmane just like to any other newsserver. Once you do, you have access to a couple hundred other Python mailing lists and 1000s of others. I believe c.l.p is one of the few that also appear on gmane, and only because of its gateway to/from python-list. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: A terminators' club for clp
r wrote: On Nov 14, 4:52 pm, Terry Reedy tjre...@udel.edu wrote: So, the only reason to use c.l.p is if one wants to post anonymously, like the spammers do ;-). I don't think that completely correct. Lots of people find GG's to be more suited to their news reading pleasures, I was referring to c.l.p on a nntp newsserver read by a newsreader program. That was the context of the previous discussion. G.G. is different, read through a browser (and only that, as far as I know). i am one of them. I hate to have an email just overflowing with mails all the time. Here in GG's, i just come and go without worrying about deleting messages or kill filters or whatever. That is why I read python-list and other mailing lists (that are not available as a g.g.) via gmane. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: A terminators' club for clp
Ben Finney wrote: Terry Reedy tjre...@udel.edu writes: So, the only reason to use c.l.p is if one wants to post anonymously, like the spammers do ;-). Or if one has an ISP who provides a Usenet feed, like mine does. Gmane is a nntp news feed, just not a usenet feed. If you can read usenet, you can read gmane, probably in the time it took you to write this post -- and get access to 1000s of mirrer mailing lists. I switched to gmane's mirror of python-list *before* I had to because it was superior, overall, to my ISP at the time. Hoever, if you like the extra spam, don't spend the minute it takes. But my comment is directed at those complaining about it. Just tell your newsreader to make a new news 'account' for news.gmane.org or snews.gmane.org (port 563) to use ssl - either at the corresponding default ports. tjr -- http://mail.python.org/mailman/listinfo/python-list
Re: python simply not scaleable enough for google?
This whole thread has now proceeded to bore me senseless. I'm going to respond once with a restatement of what I originally said. Then I'm going to drop it, and never respond to the thread again. Much of what's below has been said by others as well; I'm taking no credit for it, just trying to put it together into a coherent framework. 1. The original question is `Is Python scalable enough for Google' (or, I assume any other huge application). That's what I was responding to. 2. `Scalable' can mean performance or productivity/reliability/maintenance quality. A number of posters conflated those. I'll deal with p/r/m by saying I'm not familiar with any study that has taken real enterprise-type programs and compared, e.g., Java, Python, and C++ on the p/r/m criteria. Let's leave that issue by saying that we all enjoy programming in Python, and Python has pretty much the same feature set (notably modules) as any other enterprise language. This just leaves us with performance. 3. Very clearly CPython can be improved. I don't take most benchmarks very seriously, but we know that CPython interprets bytecode, and thus suffers relative to systems that compile into native code, and likely to some other interpretative systems. (Lua has been mentioned, and I recall looking at a presentation by the Lua guys on why they chose a register rather than stack-based approach.) 4. Extensions such as numpy can produce tremendous improvements in productivity AND performance. One answer to `is Python scalable' is to rephrase it as `is Python+C scalable'. 5. There are a number of JIT projects being considered, and one or more of these might well hold promise. 6. Following Scott Meyers' outstanding advice (from his Effective C++ books), one should prefer compile time to runtime wherever possible, if one is concerned about performance. An implementation that takes hints from programmers, e.g., that a certain variable is not to be changed, or that a given argument is always an int32, can generate special-case code that is at least in the same ballpark as C, if not as fast. This in no way detracts from Python's dynamic nature: these hints would be completely optional, and would not change the semantics of correct programs. (They might cause programs running on incorrect data to crash, but if you want performance, you are kind of stuck). These hints would `turn off' features that are difficult to compile into efficient code, but would do so only in those parts of a program where, for example, it was known that a given variable contains an int32. Dynamic (hint-free) and somewhat less-dynamic (hinted) code would coexist. This has been done for other languages, and is not a radically new concept. Such hints already exist in the language; __slots__ is an example. The language, at least as far as Python 3 is concerned, has pretty much all the machinery needed to provide such hints. Mechanisms that are recognized specially by a high-performance implementation (imported from a special module, for example) could include: annotations, decorators, metaclasses, and assignment to special variables like __slots__. 7. No implementation of Python at present incorporates JITting and hints fully. Therefore, the answer to `is CPython performance-scalable' is likely `NO'. Another implementation that exploited all of the features described here might well have satisfactory performance for a range of computation-intensive problems. Therefore, the answer to `is the Python language performance-scalable' might be `we don't know, but there are a number of promising implementation techniques that have been proven to work well in other languages, and may well have tremendous payoff for Python'. -- v -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple object reference
Chris Rebert wrote: On Sat, Nov 14, 2009 at 3:25 PM, AON LAZIO aonla...@gmail.com wrote: Hi, I have some problem with object reference Say I have this code a = b = c = None slist = [a,b,c] Values are stored in the list, not references to names. That is not right either, or else newbies would not be surprised by a = [0] b = [a] b[0][0] = 1 a [1] Subscriptable collections associate subscripts with objects. Namespaces associated names with objects. In either case, if you change the object, you change it, regardless of how you access it, such as by means of other associations. If you replace an association by associating a name or subscript with a new object, the old object is untouched (unless that was its last association) and other access methods by means of other associations are not affected. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple object reference
On Sat, Nov 14, 2009 at 6:53 PM, Terry Reedy tjre...@udel.edu wrote: Chris Rebert wrote: On Sat, Nov 14, 2009 at 3:25 PM, AON LAZIO aonla...@gmail.com wrote: Hi, I have some problem with object reference Say I have this code a = b = c = None slist = [a,b,c] Values are stored in the list, not references to names. That is not right either, or else newbies would not be surprised by a = [0] b = [a] b[0][0] = 1 a [1] Subscriptable collections associate subscripts with objects. Namespaces associated names with objects. In either case, if you change the object, you change it, regardless of how you access it, such as by means of other associations. If you replace an association by associating a name or subscript with a new object, the old object is untouched (unless that was its last association) and other access methods by means of other associations are not affected. Okay, I should have technically said references to objects rather than values, but in any case, names themselves are certainly not referenced or the following would print [1]. a = [0] b = [a] a = [42] b[0][0] = 1 a [42] Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: python simply not scaleable enough for google?
On Fri, 13 Nov 2009 18:25:59 -0800, Vincent Manis wrote: On 2009-11-13, at 15:32, Paul Rubin wrote: This is Usenet so please stick with Usenet practices. Er, this is NOT Usenet. Actually it is. I'm posting to comp.lang.python. 1. I haven't, to the best of my recollection, made a Usenet post in this millennium. Actually you have, you just didn't know it. 2. I haven't fired up a copy of rn or any other news reader in at least 2 decades. 3. I'm on the python-list mailing list, reading this with Apple's Mail application, which actually doesn't have convenient ways of enforcing `Usenet practices' regarding message format. Nevertheless, the standards for line length for email and Usenet are compatible. 4. If we're going to adhere to tried-and-true message format rules, I want my IBM 2260 circa 1970, with its upper-case-only display and weird little end-of-line symbols. No you don't, you're just taking the piss. Stephen asked me to wrap my posts. I'm happy to do it. Can we please finish this thread off and dispose of it? My name is actually Steven, but thank you for wrapping your posts. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Vote on PyPI comments
On Fri, 13 Nov 2009 07:53:05 -0800, Michele Simionato wrote: I am skeptical about the utility of both rating and comments. If somebody wants to know if a package is good, she should ask here. Because unlike people writing comments, people here are never incompetent, misinformed, dishonest, confused, trolling or just wrong. But sometimes sarcastic. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: The ol' [[]] * 500 bug...
On Fri, 13 Nov 2009 21:26:01 +, kj wrote: ...just bit me in the fuzzy posterior. It's not a bug. Just because it doesn't behave as you would like it to behave doesn't mean it isn't behaving as designed. The best I can come up with is the hideous lol = [[] for _ in xrange(500)] That's not hideous. Is there something better? What did one do before comprehensions were available? I suppose in that case one would have to go all the way with lol = [None] * 500 for i in xrange(len(lol)): lol[i] = [] Yikes. 10 miles uphill, both ways... What's wrong with that? lol = [] for _ in xrange(500): lol.append([]) is a simple alternative too, although the list comp is better. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Go
On Sat, 14 Nov 2009 11:14:04 +, kj wrote: In 7xpr7lixnn@ruckus.brouhaha.com Paul Rubin http://phr...@nospam.invalid writes: It seems a little weird to me that they (Google) are concerned with the speed of the compiler, indicating that they plan to write enormous programs in the language. Fast compilation also means that Go can conceivably become an attractive alternative to interpreted languages, because the compilation stage can be made as unobtrusive as, say, Python's byte-compilation stage (except that the Go compiler is generating native code). Python (like many other languages) already has unobtrusive compilation. That's why you get .pyc files, and that's what the compile() built-in function does. It is compilation to byte-code rather than machine-code, but still. Psyco does JIT compilation to machine-code for CPython, at the cost of much extra memory. It's also limited to 32-bit Intel processors. The aim of the PyPy project is to (eventually) make JIT machine-code compilation available to any Python, on any machine. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Anything better than shutil?
On Sat, 14 Nov 2009 07:48:39 -0800, Roy Smith wrote: I'm converting some old bash scripts to python. There's lots of places where I'm doing things like rm $source_dir/*.conf. The best way I can see to convert this into python is: configs = glob.glob(os.path.join(source_dir, '*.conf')) for conf_file in configs: shutil.copy(conf_file, conf_dir) which is pretty clunky. Particularly since you're converting a remove to a copy... I suppose if you're used to the sort of terse code filled with magic characters that you find in bash, then the Python code might seem a bit verbose. And I suppose you would be right :) But trying to do something complicated in bash rapidly becomes *far* more verbose, unreadable and clunky than Python. The idea interface I see would be one like: shutil.copy([source_dir, '*.conf'], conf_dir) Then write a helper function, and call that. # Untested. def copy(glb, destination): if not isinstance(glb, str): glb = os.path.join(*glb) glb = glob.glob(glb) for source in glb: shutil.copy(source, destination) -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: python simply not scaleable enough for google?
Steven D'Aprano wrote: On Wed, 11 Nov 2009 16:38:50 -0800, Vincent Manis wrote: I'm having some trouble understanding this thread. My comments aren't directed at Terry's or Alain's comments, but at the thread overall. 1. The statement `Python is slow' doesn't make any sense to me. Python is a programming language; it is implementations that have speed or lack thereof. Of course you are right, but in common usage, Python refers to CPython, and in fact since all the common (and possibly uncommon) implementations of Python are as slow or slower than CPython, it's not an unreasonable short-hand. Take a good look at Shed Skin. One guy has been able to build a system that compiles Python to C++, without requiring the user to add annotations about types. The system uses type inference to figure it out itself. You give up some flexibility; a variable can have only one primitive type in its life, or it can be a class object. That's enough to simplify the type analysis to the point that most types can be nailed down before the program is run. (Note, though, that the entire program may have to be analyzed as a whole. Separate compilation may not work; you need to see the callers to figure out how to compile the callees.) It's 10 to 60x faster than CPython. It's the implementation, not the language. Just because PyPy was a dud doesn't mean it's impossible. There are Javascript JIT systems far faster than Python. Nor do you really need a JIT system. (Neither does Java; GCC has a hard-code Java compiler. Java is JIT-oriented for historical reasons. Remember browser applets?) If you're doing server-side work, the program's structure and form have usually been fully determined by the time the program begins execution. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: QuerySets in Dictionaries
On Fri, 13 Nov 2009 14:10:10 -0800, scoopseven wrote: I actually had a queryset that was dynamically generated, so I ended up having to use the eval function, like this... d = {} for thing in things: query_name = 'thing_' + str(thing.id) query_string = 'Thing.objects.filter(type=' + str(thing.id) + ').order_by(\'-date\')[:3]' executable_string = query_name + ' = Thing.objects.filter (type=' + str(thing.id) + ').order_by(\'-date\')[:3]' exec(executable_string) d[query_name] = eval(query_string) What an unmaintainable mess. If I've understood it, you can make it less crap by (1) getting rid of the unnecessary escaped quotes, (2) avoiding generating the same strings multiple times, and (3) avoiding string concatenation. d = {} for thing in things: expr = Thing.objects.filter(type=%s).order_by('-date')[:3] expr = rhs % thing.id name = thing_%s % thing.id exec(%s = %s % (name, expr)) d[name] = eval(expr) What else can we do to fix it? Firstly, why are you creating local variables thing_XXX (where XXX is the thing ID) *and* dictionary keys of exactly the same name? I'm sure you don't need the local variables. (If you think you do, you almost certainly don't.) That gets rid of the exec. Next, let's get rid of the eval: d = {} for thing in things: x = thing.id name = thing_%s % x d[name] = Thing.objects.filter(type=x).order_by('-date')[:3] About half the size, ten times the speed, and 1000 times the readability. Unless I've missed something, you don't need either exec or eval. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Go
On Nov 14, 7:18 pm, John Nagle na...@animats.com wrote: Leaving out exceptions was a mistake. Exceptions are well understood now, and they're far better than the usual ignore errors approach one sees in lamer C programs. I am also surprised about the lack of exceptions. I could infer that Rob Pike and Ken Thompson are idiots that lack experience with languages with exceptions, or I could infer that they have reasons for doing so. I do not know about exceptions enough to have an opinion myself. However I will notice that in Python, when using threads, exceptions do not work so well: if I forget to trap an exception in a thread I see a traceback on stderr, but the other threads continue to run, basically ignoring the exception. Probably the language that get things right is Erlang, which is supervising all crashed process and it is designed to safely recover for unexpected events. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Go
On Nov 15, 3:00 am, Terry Reedy tjre...@udel.edu wrote: It seems to me that generators are already 'channels' that connect the calling code to the __next__ method, a semi-coroutine based on the body of the generator function. At present, the next method waits until an object is requested. Then it goes into action, yields an object, and rests again. I see no reason why we cannot have that with Python. I not even sure we cannot have it with CPython, but I am not familiar enough with threads, processes, and CPython internals. Of course we can have Go capabilities with Python. We already have generators and the multiprocessing module. It is just a matter of performance: I assume the Go implementation is more efficient. It would be nice to have numbers to quantify this claim. One can still write prototypes in Python and convert them in Go and the process looks less cumbersome than converting them in C or C++. I could never force myself to write C or C++; but I do not have any particular resistence to coding in Go, should I need a performance-oriented language. -- http://mail.python.org/mailman/listinfo/python-list
Re: Req. comments on first version ch 2 progr. intro (using Python 3.x in Windows)
In article mailman.137.1257787943.2873.python-l...@python.org, sstein...@gmail.com sstein...@gmail.com wrote: On Nov 9, 2009, at 11:54 AM, Jon Clements wrote: On Nov 9, 4:10 pm, Alf P. Steinbach al...@start.no wrote: First, because as opposed to ch 1 there is quite a bit of code here, and since I'm a Python newbie I may be using non-idiomatic constructs, Welp, there goes my last excuse. I'm off to write my book: Heart Surgery at Home *** How to Save Thousands and Get Results Just Like in Hospital Chapter 1: Sanitation, Schmanitation: How Clean is Clean Enough? Chapter 2: Surgical Tools vs. Ginsu: How Sharp is Sharp Enough? Chapter 3: Gray's Anatomy and Sharpies: Laying out The Surgery Chapter 4: Before You Start: Charging Your Cell Phone, and Testing 911 Chapter 5: Anesthesia: Jack Daniels or Smirnoffs; How Much is Enough? Chapter 6: The Insanity Defense: Laying the Groundwork with 6 Month Plan That's as far as I've gotten... Amazon best seller list, here I come! +1 QOTW -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ [on old computer technologies and programmers] Fancy tail fins on a brand new '59 Cadillac didn't mean throwing out a whole generation of mechanics who started with model As. --Andrew Dalke -- http://mail.python.org/mailman/listinfo/python-list
Re: Easy way to play single musical notes in Python
On Nov 14, 6:21 pm, James Harris james.harri...@googlemail.com wrote: Is there a simple way to play musical notes in Python? Something like voice.play(c4) Uhh, tksnack is pretty easy to use IMO, see this link... http://www.daniweb.com/code/snippet216655.html No python does not have access to cross platform soundcard capabilities built into the language. I think there is a wrapper for csound somewhere. But there are many 3rd party modules that do have capabilities to some extent. You could make calls to the underlying OS machinery and there is the winsound module (not exactly what you want though). Just look over this Google splooge... http://www.google.com/search?hl=enrlz=1C1CHMI_enUS340US340q=Python+soundaq=foq=aqi=g10 -- http://mail.python.org/mailman/listinfo/python-list
Re: A different take on finding primes
Vincent Davis wrote: Out of pure curiosity I would like to compare the efficiency of different methods of finding primes (need not be consecutive). Let me be clear, given 2min, how many primes can you find, they need not be in order or consecutive. I have not seen any examples of this. I am assume the solution is different depending on the time give, 2min or 2 hours. I assume a sieve solution would be best for larger times. When the numbers get really large checking to see if they are a prime gets costly. So what do you think? *Vincent Davis 720-301-3003 * vinc...@vincentdavis.net my blog http://vincentdavis.net | LinkedInhttp://www.linkedin.com/in/vincentdavis The sieve can be very efficiently written, but you have to decide whether to optimize for memory size or for speed. At a minimum for size you need an object for each prime currently found, and you will be looking through that list for each new candidate. Incidentally this approach can be done without any division. If you have memory to burn, you make a bit array equal in size to the largest prime you expect to encounter. There are also good algorithms for deciding whether a number of a particular form is prime. For example, there's a test for numbers of the form 2**n + 1. And don't forget the Miller-Rabin test. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Python as network protocol
In article e16564d8-6e3e-4973-be9c-1e2c81fce...@h34g2000yqm.googlegroups.com, Cooch kochkin.dmi...@gmail.com wrote: I want to implement such specific feature: I have a server written in Python. I have a client written in C++. I want to use Python as network protocol between them. I mean: client send to server such string: a = MyObject(), so object of this type will appear in server. Any ideas how to simplify this implementation? I make XML-RPC/SOAP server using twisted which just execute sended string. But I don't know how to: 1. Restrict usage of some modules on client side (os, sys etc..) 2. Divide variables of different clients. Generally, I know that I should use exec .. in .. construct, but don't know how to distinguish between clients in twisted. What you want is a DSL -- domain-specific language. That might be a subset of Python that you parse yourself. -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ [on old computer technologies and programmers] Fancy tail fins on a brand new '59 Cadillac didn't mean throwing out a whole generation of mechanics who started with model As. --Andrew Dalke -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Go
Let me add a quote from the FAQ: Why does Go not have exceptions? Exceptions are a similar story. A number of designs for exceptions have been proposed but each adds significant complexity to the language and run-time. By their very nature, exceptions span functions and perhaps even goroutines; they have wide-ranging implications. There is also concern about the effect they would have on the libraries. They are, by definition, exceptional yet experience with other languages that support them show they have profound effect on library and interface specification. It would be nice to find a design that allows them to be truly exceptional without encouraging common errors to turn into special control flow that requires every programmer to compensate. Like generics, exceptions remain an open issue. -- http://mail.python.org/mailman/listinfo/python-list
Re: A terminators' club for clp
In article 877htsskox@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: Terry Reedy tjre...@udel.edu writes: So, the only reason to use c.l.p is if one wants to post anonymously, like the spammers do ;-). Or if one has an ISP who provides a Usenet feed, like mine does. Mine does, too. A pox upon Andrew Cuomo for bashing ISPs in the USA with the stick of âchild pornographyâ (which he discovered on 88 out of many thousands of forums). Faced with the unreasonable role of policing Usenet, they shut it all off URL:http://news.cnet.com/8301-13578_3-9964895-38.html. Actually, my ISP is in New York City. -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ [on old computer technologies and programmers] Fancy tail fins on a brand new '59 Cadillac didn't mean throwing out a whole generation of mechanics who started with model As. --Andrew Dalke -- http://mail.python.org/mailman/listinfo/python-list
Re: Documentation bugs in 3.1 - C-API - TypeObjects
Thanks ! Okay, i've already used the call of tp_free as the last statement in tp_dealloc and do understand now, that a call of tp_dealloc should be the last statement in the code for tp_free in specific cases. And yes, Py_Type(Foo_Type) = PyType_Type will be more stable against changes of the object implementation. Still there remains the difference to what is told with the Noddy_Type in the tutorial. Skimmimg through PyType_Ready in typeobject.c i find, that 3760 if (Py_TYPE(type) == NULL base != NULL) 3761 Py_TYPE(type) = Py_TYPE(base); are the only lines referring to what is ob_type now. Thus the quoted lines from the tutorial ending with Fortunately, this member will be filled in for us by PyType_Ready(). are possibly wrong (respective outdated) too. The two lines above are, what happens to my extension classes, if i want to derive application classes from them. class(my_extension_class): ... will of course call more from Python than PyTypeReady, but PyType(type) = Py_TYPE(base) is not getting corrected by this more here and the class statement doesn't create a new type. I will examine now, why this happens (without a crash of the calling application !), but still welcome every hint. Seen from a strict perspective this is a bug in Python's C-API. I'll save a freeze of the code for my extension for anyone, who might interested to reproduce this. Joost -- http://mail.python.org/mailman/listinfo/python-list
Re: python simply not scaleable enough for google?
On Saturday 14 November 2009 18:42:07 Vincent Manis wrote: 3. Very clearly CPython can be improved. I don't take most benchmarks very seriously, but we know that CPython interprets bytecode, and thus suffers relative to systems that compile into native code, and likely to some other interpretative systems. (Lua has been mentioned, and I recall looking at a presentation by the Lua guys on why they chose a register rather than stack-based approach.) For those interested in exploring the possible performance benefits of Python on a register-based VM, there's Pynie (http://code.google.com/p/pynie/)... and there's even a JIT in the works for that (http://docs.parrot.org/parrot/1.0.0/html/docs/jit.pod.html)... Rami Chowdhury A man with a watch knows what time it is. A man with two watches is never sure. -- Segal's Law 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD) -- http://mail.python.org/mailman/listinfo/python-list
Re: python simply not scaleable enough for google?
John Nagle wrote: Steven D'Aprano wrote: Take a good look at Shed Skin. One guy has been able to build a system that compiles Python to C++, without requiring the user to add annotations about types. In *only* compiles a subset of Python, as does Cython. Both cannot (currently) do generators, but that can be done and probably will eventually at least for Cython. Much as I love them, they can be rewritten by hand as iterator classes and even then are not needed for a lot of computational code. I think both are good pieces of work so far. The system uses type inference to figure it out itself. You give up some flexibility; a variable can have only one primitive type in its life, or it can be a class object. That's enough to simplify the type analysis to the point that most types can be nailed down before the program is run. (Note, though, that the entire program may have to be analyzed as a whole. Separate compilation may not work; you need to see the callers to figure out how to compile the callees.) It's 10 to 60x faster than CPython. It's the implementation, not the language. Just because PyPy was a dud doesn't mean it's impossible. There are Javascript JIT systems far faster than Python. Nor do you really need a JIT system. (Neither does Java; GCC has a hard-code Java compiler. Java is JIT-oriented for historical reasons. Remember browser applets?) If you're doing server-side work, the program's structure and form have usually been fully determined by the time the program begins execution. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Calling Python functions from Excel
Hi, unfortunately is my question about server COM (win32com) http://groups.google.com/group/comp.lang.python/browse_thread/thread/ee804cec7f58c6a7# without answer. Please I need Calling Python functions from Excel and receive result back in Excel. Can me somebody advise simplest solution please? I am more VBA programmer than Python. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: python simply not scaleable enough for google?
John Nagle wrote: Take a good look at Shed Skin. ... You give up some flexibility; a variable can have only one primitive type in its life, or it can be a class object. That's enough to simplify the type analysis to the point that most types can be nailed down before the program is run. These restrictions mean that it isn't really quite Python, though. -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Calling Python functions from Excel
Cannonbiker wrote: Please I need Calling Python functions from Excel and receive result back in Excel. Can me somebody advise simplest solution please? I am more VBA programmer than Python. Maybe this will help: http://oreilly.com/catalog/pythonwin32/chapter/ch12.html (Scroll down to Implementing a COM Server.) -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
[issue7320] Unable to load external modules on build slave with debug python
Changes by Martin v. Löwis mar...@v.loewis.de: -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7320 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7321] PyIter_Check(obj) fails when obj is of type PySetType
New submission from Damian Eads damian.e...@gmail.com: The instructions for the C interface to the Python set class http://docs.python.org/c-api/set.html say to use PyObject_GetIter and follow the iterator protocol. After following the instructions for the iterator protocol here, http://docs.python.org/c-api/iter.html I was able to successfully iterate through a set object. However, PyIter_Check(obj) returns false yet set objects follow the iterator protocol. Is this the correct behavior? Thank you. Kind regards, Damian Eads -- messages: 95229 nosy: damianeads severity: normal status: open title: PyIter_Check(obj) fails when obj is of type PySetType versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Trundle andy-pyt...@hammerhartes.de added the comment: Crashes reliable with a segfault in Python 3.1.1. Fixing the setter so that one can only set strings and not arbitrary objects is possibly the best solution. -- nosy: +Trundle versions: +Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7296] OverflowError: signed integer is greater than maximum on mips64
jasper jas...@humppa.nl added the comment: Removing --with-fpectl makes no difference. I'll try the _PyHash_Double-thing later this weekend. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7296 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Eric Smith e...@trueblade.com added the comment: I'm not sure why reason should be restricted to a string. This patch (against trunk) just converts reason to a string when str() is called. I'll add tests and fix the other places in exceptions.c where similar shortcuts are taken without checking, if there's agreement on the approach. -- assignee: - eric.smith nosy: +eric.smith priority: low - high stage: test needed - patch review type: - crash versions: +Python 2.6, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Eric Smith e...@trueblade.com added the comment: Actually attach the patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Eric Smith e...@trueblade.com added the comment: One more time with the patch attachment. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Changes by Eric Smith e...@trueblade.com: -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Changes by Eric Smith e...@trueblade.com: -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Eric Smith e...@trueblade.com added the comment: For some reason I'm not able to attach the patch file. I'll look at that, but in the meantime here's the preliminary patch against trunk: Index: Objects/exceptions.c === --- Objects/exceptions.c(revision 76258) +++ Objects/exceptions.c(working copy) @@ -1779,7 +1779,13 @@ UnicodeTranslateError_str(PyObject *self) { PyUnicodeErrorObject *uself = (PyUnicodeErrorObject *)self; +PyObject *result = NULL; +PyObject *reason_str = NULL; +reason_str = PyObject_Str(uself-reason); +if (reason_str == NULL) +goto done; + if (uself-end==uself-start+1) { int badchar = (int)PyUnicode_AS_UNICODE(uself-object)[uself-start]; char badchar_str[20]; @@ -1789,19 +1795,22 @@ PyOS_snprintf(badchar_str, sizeof(badchar_str), u%04x, badchar); else PyOS_snprintf(badchar_str, sizeof(badchar_str), U%08x, badchar); -return PyString_FromFormat( +result = PyString_FromFormat( can't translate character u'\\%s' in position %zd: %.400s, badchar_str, uself-start, -PyString_AS_STRING(uself-reason) +PyString_AS_STRING(reason_str) ); -} -return PyString_FromFormat( -can't translate characters in position %zd-%zd: %.400s, -uself-start, -uself-end-1, -PyString_AS_STRING(uself-reason) -); +} else +result = PyString_FromFormat( +can't translate characters in position %zd-%zd: %.400s, +uself-start, +uself-end-1, +PyString_AS_STRING(reason_str) +); +done: +Py_XDECREF(reason_str); +return result; } static PyTypeObject _PyExc_UnicodeTranslateError = { -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7298] reversed(range(x, -1, -1)) is empty when x 1
Mark Dickinson dicki...@gmail.com added the comment: It looks like the PyLong version of reverse is broken too: list(range(10**100, 10**100-2, -2)) [1 ] list(reversed(range(10**100, 10**100-2, -2))) [9 998] -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7315] os.path.normpath doesn't normalize ../path/something.py
Georg Brandl ge...@python.org added the comment: If your current directory is (e.g.) /home/user, then ../xyz will not bring you back to it. (xyz/.. would.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7315 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Ezio Melotti ezio.melo...@gmail.com added the comment: Note that on Py2.6, when, for example, a string is assigned to u.start and u.end a TypeError is raised, and the value is then set to -1: u=UnicodeTranslateError(u'x', 1, 5, 'bah') u.start = 'foo' Traceback (most recent call last): File stdin, line 1, in module TypeError: an integer is required u.end = 'bar' Traceback (most recent call last): File stdin, line 1, in module TypeError: an integer is required str(u) can't translate characters in position -1--2: bah u.start, u.end (-1, -1) Is it possible to change the values assigning an int (or even a float that is then converted to int). On py3k the behavior is different; as Trundle said, it segfaults easily, and trying to change the value of u.start and u.end returns a different error: u.start = 'foo' Traceback (most recent call last): File stdin, line 1, in module SystemError: Objects/longobject.c:441: bad argument to internal function Also note that on both the versions there's no check on these values either, it's easy to have a segfault doing this: u = UnicodeTranslateError(u'x', 1, 5, 'bah') u.start = 2**30 u.end = 2**30+1 str(u) (if the char is only one, Python will try to read it and display it) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7298] reversed(range(x, -1, -1)) is empty when x 1
Mark Dickinson dicki...@gmail.com added the comment: I've updated to patch to improve the tests, and fix the problems with the PyLong version of range.__reversed__. (Also updated on Rietveld.) -- Added file: http://bugs.python.org/file15329/issue7298_v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7321] PyIter_Check(obj) fails when obj is of type PySetType
Antoine Pitrou pit...@free.fr added the comment: Set objects are iterable, they are not iterators themselves. In other words, PyIter_Check() should return true when called with the result of PyObject_GetIter() (but normally you don't need to check anyway). -- nosy: +pitrou resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7312] Run some tests in a loop until failure
Antoine Pitrou pit...@free.fr added the comment: I've attached an updated patch that fixes the problem, but I'm not sure it is a correct fix. Your patch looks fine to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7312 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5672] Implement a way to change the python process name
Changes by Domen ielect...@gmail.com: -- nosy: +iElectric ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5672 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7312] Run some tests in a loop until failure
R. David Murray rdmur...@bitdance.com added the comment: Committed to trunk in r76260 and py3k in r76261. -- resolution: - accepted stage: patch review - committed/rejected status: open - closed type: behavior - feature request ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7312 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4683] urllib2.HTTPDigestAuthHandler fails on third hostname?
Changes by Senthil Kumaran orsent...@gmail.com: -- assignee: - orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4683 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6963] Add worker process lifetime to multiprocessing.Pool - patch included
Charles Cazabon charlesc-pyt...@pyropus.ca added the comment: Hi Jesse -- Any chance you'll be able to review this in time for it to make it into trunk for the 2.7 alpha release? Charles -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6963 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7005] ConfigParser does not handle options without values
Mats Kindahl m...@sun.com added the comment: So, what is the status on this? Who needs to review it? Is there anything I can do to get it accepted? Do I need to make any changes (in addition to those already suggested and done by fdrake)? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7005 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7322] Socket timeout can cause file-like readline() method to lose data
New submission from David M. Beazley beaz...@users.sourceforge.net: Consider a socket that has had a file-like wrapper placed around it using makefile() # s is a socket created previously f = s.makefile() Now, suppose that this socket has had a timeout placed on it. s.settimeout(15) If you try to read data from f, but nothing is available. You'll eventually get a timeout. For example: f.readline() # Now, just wait Traceback (most recent call last): File stdin, line 1, in module File /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket. py, line 406, in readline data = self._sock.recv(self._rbufsize) socket.timeout: timed out However, now consider the case where you're reading a line of data, but the receiver has only received a partial line and it's waiting for the rest of the data to arrive. For example, type this: f.readline() Now, go to the other end of the socket connection and send a buffer with no newline character. For example, send the message Hello. Since no newline character has been received, the readline() method will eventually fail with a timeout as before. However, if you now retry the read operation f.readline() and send more data such as the message World\n, you'll find that the Hello message gets lost. In other words, the repeated readline() operation discards any buffers corresponding to previously received line data and just returns the new data. Admittedly this is a corner case, but you probably don't want data to be discarded on a TCP connection even if a timeout occurs. Hope that makes some sense :-). (It helps to try it out). -- components: Library (Lib) messages: 95245 nosy: beazley severity: normal status: open title: Socket timeout can cause file-like readline() method to lose data type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4722] _winreg.QueryValue fault while reading mangled registry values
Gabriel Genellina gagsl-...@yahoo.com.ar added the comment: I've noticed this depends on the user privileges. When logged in as a normal user, I get the internal error as originally reported. When logged in as an administrator, there is no error and I get an empty string. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6666] List of dirs to ignore in trace.py is applied only for the first file
Changes by Gabriel Genellina gagsl-...@yahoo.com.ar: -- versions: +Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3892] bsddb: test01_basic_replication fails sometimes
R. David Murray rdmur...@bitdance.com added the comment: Failures still occur occasionally even with the timeout set to 60. So I've turned the check that is skipped on Windows from an assertion into a warning only on all other platforms, since bsddb support isn't actively maintained and is gone in py3k. Fix applied to trunk in r76265 and 2.6 in r76267. -- components: +Tests stage: - patch review title: bsddb: test01_basic_replication fails on Windows sometimes - bsddb: test01_basic_replication fails sometimes type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3892 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7323] decimal.Decimal greater than/less than sometimes gives wrong answers when comparing to floats.
New submission from Adam Tomjack a...@zuerchertech.com: These should all return False, or some of them should raise exceptions: Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18) [GCC 4.3.3] on linux2 Type help, copyright, credits or license for more information. import decimal decimal.Decimal('0') 0 False decimal.Decimal('0') 0 False decimal.Decimal('0') 0.0 True decimal.Decimal('0') 0.0 False 0.0 decimal.Decimal('0') False 0.0 decimal.Decimal('0') True 0.0 decimal.Decimal('0.0') True decimal.Decimal('0') decimal.Decimal('0') False -- components: Library (Lib) messages: 95248 nosy: adamtj severity: normal status: open title: decimal.Decimal greater than/less than sometimes gives wrong answers when comparing to floats. versions: Python 2.4, Python 2.5, Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7323 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7323] decimal.Decimal greater than/less than sometimes gives wrong answers when comparing to floats.
Changes by Adam Tomjack a...@zuerchertech.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7323 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7324] Add sanity-check else case to regrtest option parsing
New submission from R. David Murray rdmur...@bitdance.com: In forward porting a patch to py3k I noticed that there is a 'g' option in the optparse argument list in regrtest in 2.x that is not present in 3.x. But the surprising thing was that there are no docs for this option, nor any option handler in the 2.x regrtest. I propose to add an 'else' case to the option parsing loop that asks the user to report a bug if it is handed an unknown option. Patch attached. My one question is whether this might have been intentional for backward compatibility reasons: let -g be passed and ignore it silently. I'm guessing it was just a deletion oversight, though. -- components: Tests files: regrtest-detect-bad-option.patch keywords: patch, patch messages: 95249 nosy: pitrou, r.david.murray priority: low severity: normal stage: patch review status: open title: Add sanity-check else case to regrtest option parsing type: feature request versions: Python 2.7, Python 3.2 Added file: http://bugs.python.org/file15330/regrtest-detect-bad-option.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7324 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6963] Add worker process lifetime to multiprocessing.Pool - patch included
Jesse Noller jnol...@gmail.com added the comment: On Sat, Nov 14, 2009 at 11:43 AM, Charles Cazabon rep...@bugs.python.org wrote: Charles Cazabon charlesc-pyt...@pyropus.ca added the comment: Hi Jesse -- Any chance you'll be able to review this in time for it to make it into trunk for the 2.7 alpha release? 2.7 isn't slated until next year some time, so yes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6963 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Eric Smith e...@trueblade.com added the comment: The patch that is (hopefully) attached is a first, incomplete cut just for demonstration purposes. I still need to cover all of the cases where PyString_AS_STRING are called without type checking. Also, as Ezio points out, start and end are used to index an array without type checking. I'll fix that as well. The patch is against trunk. -- keywords: +patch Added file: http://bugs.python.org/file15331/issue7309.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Changes by Eric Smith e...@trueblade.com: -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7323] decimal.Decimal greater than/less than sometimes gives wrong answers when comparing to floats.
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7323 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Ezio Melotti ezio.melo...@gmail.com added the comment: The same problem (u.start and u.end) also affects the other UnicodeError exceptions (namely UnicodeEncodeError and UnicodeDecodeError). Py2.4 and 2.5 don't seem to segfault with the example I provided. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4080] pyunit - display time of each test case - patch
Pawel Prokop pa...@uek.krakow.pl added the comment: Repack of unittest was good idea. It is a patch against trunk, one test case is provided and documentation update. -- Added file: http://bugs.python.org/file15332/unittest_runTime.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4080 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7324] Add sanity-check else case to regrtest option parsing
R. David Murray rdmur...@bitdance.com added the comment: That should have been 'getopt option list'. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7324 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7324] Add sanity-check else case to regrtest option parsing
Brett Cannon br...@python.org added the comment: I bet it was an option oversight. Since regrtest is an internal tool we don't really need to fret about backwards-compatibility for anyone. -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7324 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7325] tempfile.mkdtemp() does not return absolute pathname when dir is specified
New submission from Roy Smith r...@panix.com: The docs (http://www.python.org/doc/2.5.1/lib/module-tempfile.html) specify that mkdtemp(), returns the absolute pathname of the new directory. It does that in the default case, but if you specify a relative path for 'dir', you get back a relative path. $ python Python 2.5.1 (r251:54863, Oct 17 2008, 14:39:09) [GCC 3.4.6 20060404 (Red Hat 3.4.6-10)] on linux2 Type help, copyright, credits or license for more information. import tempfile tempfile.mkdtemp(dir='.') './tmpHk1pBD' similar results were obtained on: Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Note that mkstemp() gets it right: tempfile.mkdtemp(dir='.') './tmpoPXdL7' tempfile.mkstemp(dir='.') (3, '/Users/roy2/tmpwTGZ2y') -- components: Library (Lib) messages: 95256 nosy: roysmith severity: normal status: open title: tempfile.mkdtemp() does not return absolute pathname when dir is specified type: behavior versions: Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7325 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7322] Socket timeout can cause file-like readline() method to lose data
Changes by Gregory P. Smith g...@krypto.org: -- assignee: - gregory.p.smith nosy: +gregory.p.smith priority: - normal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7322 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7325] tempfile.mkdtemp() does not return absolute pathname when dir is specified
R. David Murray rdmur...@bitdance.com added the comment: This is true on trunk and py3k as well. 2.5 is in security fix only mode, so I've removed it from the versions list. Since mkstemp does return in the absolute path in this case, I think this is a code rather than a documentation bug. However, changing it would be backward incompatible, so it may not be possible to fix it in 2.6 and 3.1. -- keywords: +easy nosy: +r.david.murray priority: - normal stage: - test needed versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7325 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1023290] Conversion of longs to bytes and vice-versa.
Alexandre Vassalotti alexan...@peadrop.com added the comment: Here's an updated patch. - Renamed tobytes() to to_bytes() and frombytes() to from_bytes(). - Moved the changes to pickle to a different patch. - Made the NULL-checks more consistent with the rest of long's code. - Fixed the type check of the `length' parameter of to_bytes() to use PyIndex_Check() instead of PyLong_Check(). -- dependencies: +Move the special-case for integer objects out of PyBytes_FromObject. Added file: http://bugs.python.org/file15333/long_and_bytes_conversion-3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1023290 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6804] IDLE: Detect Python files even if name doesn't end in .py
Changes by Gabriel Genellina gagsl-...@yahoo.com.ar: Removed file: http://bugs.python.org/file14803/EditorWindow.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6804] IDLE: Detect Python files even if name doesn't end in .py
Gabriel Genellina gagsl-...@yahoo.com.ar added the comment: This new patch addresses the previous comments. -- Added file: http://bugs.python.org/file15334/EditorWindow.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6906] Tkinter sets an unicode environment variable on win32
Gabriel Genellina gagsl-...@yahoo.com.ar added the comment: This patch may solve this issue, but I don't have a Vista install to test it. -- keywords: +patch Added file: http://bugs.python.org/file15335/FixTk.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6906 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Eric Smith e...@trueblade.com added the comment: Another patch against trunk which deals with: UnicodeEncodeError: reason and encoding UnicodeDecodeError: reason and encoding UnicodeTranslateError: reason Still needs tests. Also, the unchecked use of start and end needs to be addressed. I'm working on that. -- Added file: http://bugs.python.org/file15336/issue7309.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Changes by Eric Smith e...@trueblade.com: Removed file: http://bugs.python.org/file15331/issue7309.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7323] decimal.Decimal greater than/less than sometimes gives wrong answers when comparing to floats.
Mark Dickinson dicki...@gmail.com added the comment: Unfortunately there's no easy way to fix this in 2.x, where any object is supposed to be comparable with any other. See issue 2531 for a previous discussion. It's fixed in 3.x: there a comparison (other than ==, !=) between a float and a Decimal does raise an exception. Closing as a duplicate of issue 2531. Issue 2531 is also closed, but you should feel free to add to the discussion there. -- resolution: - duplicate status: open - closed superseder: - float compared to decimal is silently incorrect. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7323 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Changes by Eric Smith e...@trueblade.com: Added file: http://bugs.python.org/file15337/issue7309-1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Changes by Eric Smith e...@trueblade.com: Removed file: http://bugs.python.org/file15336/issue7309.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2531] float compared to decimal is silently incorrect.
Mark Dickinson dicki...@gmail.com added the comment: Just closed issue 7323 as a duplicate of this one. I think this issue is worth reopening: with the backport of the py3k correctly rounded string - float conversions, there might now be a reasonable way to rewrite Decimal.__hash__ so that it's consistent with float.__hash__. Then we can make Decimal-to-float comparisons behave correctly and clear up this mess. I'd still be uncomfortable with allowing Decimal-to-float comparisons in 2.x but not in 3.x. Maybe they could be permitted in 3.x too? -- resolution: wont fix - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2531 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2531] float compared to decimal is silently incorrect.
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +adamtj ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2531 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7323] decimal.Decimal greater than/less than sometimes gives wrong answers when comparing to floats.
Mark Dickinson dicki...@gmail.com added the comment: I've re-opened issue 2531: some recent changes (in particular, the backport of the 3.x float - string conversions to 2.x) may make previously rejected solutions viable again. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7323 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7309] crasher in str(Exception())
Eric Smith e...@trueblade.com added the comment: Tests need to cover issues like: # assigning a non-string to e.object e = UnicodeDecodeError(, , 0, 1, ) e.object = None print str(e) # start and end out of range e = UnicodeDecodeError(, , 0, 1, ) e.start = 1000 e.end = 1001 print str(e) For all cases of UnicodeXXXError with start and end, the code has a special case for end = start+1. Invalid start/end tests need to have end==start+1, endstart+1, endstart+1. I'm not sure what the functions should do when start and end are out of range. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4049] IDLE does not open too
Patricia Irwin plir...@gmail.com added the comment: Hi, I'm running Windows XP Professional and just installed Python 2.6. I installed it for all users. Tried starting up IDLE and nothing happened. I read the boards here, and it looks like others have had similar troubles. I read on this board that moving the Tcl/Tk directories helped, so I tried moving the tcl8.5 and tk8.5 directories to C:\Python26\Lib, but IDLE still wouldn't start up. (So I moved them back.) I opened a command shell and tried running idle that way. I will paste the output below. Could someone help with this? Sorry if this is the wrong place to post this problem; I am Python newbie. C:\Python26python Lib\idlelib\idle.py Traceback (most recent call last): File Lib\idlelib\idle.py, line 21, in module idlelib.PyShell.main() File C:\Python26\lib\idlelib\PyShell.py, line 1400, in main shell = flist.open_shell() File C:\Python26\lib\idlelib\PyShell.py, line 279, in open_shell self.pyshell = PyShell(self) File C:\Python26\lib\idlelib\PyShell.py, line 820, in __init__ OutputWindow.__init__(self, flist, None, None) File C:\Python26\lib\idlelib\OutputWindow.py, line 16, in __init__ EditorWindow.__init__(self, *args) File C:\Python26\lib\idlelib\EditorWindow.py, line 234, in __init__ self.update_recent_files_list() File C:\Python26\lib\idlelib\EditorWindow.py, line 755, in update_recent_fil es_list rf_file = open(self.recent_files_path, 'w') IOError: [Errno 13] Permission denied: 'C:\\Documents and Settings\\Tricia\\.idl erc\\recent-files.lst' -- nosy: +pi versions: +Python 2.6 -Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4049 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7324] Add sanity-check else case to regrtest option parsing
R. David Murray rdmur...@bitdance.com added the comment: Committed in r76276 through r76281, along with removing 'g' from the getopt list in 2.6. 3.1 still has other traces of the -g option; I haven't cleaned that up. -- assignee: - r.david.murray resolution: - fixed stage: patch review - committed/rejected status: open - closed type: feature request - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7324 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7293] test_msvc9compiler test_reg_class failure on new Windows box
Tarek Ziadé ziade.ta...@gmail.com added the comment: Does it have to be a DWORD, or a 0/1 value, or under HKCU for a specific reason? This notepad test was just to make sure the registry reader works by returning a known value. I can change it using: Reg.get_value(Software\Microsoft\VisualStudio\9.0\VC, Build Timing) == 0 For this test, if you can check that this value is the same on a fresh win XP and 7, it's perfect. (8.0 doesn't matter here, I can restrict the build version to 9.0) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7293 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4359] at runtime, distutils uses buildtime files
Tarek Ziadé ziade.ta...@gmail.com added the comment: This is a problem indeed. One solution would be to generate a module in the stdlib that contains all these info, when configure is called. as a matter of fact, I am currently working in a branch to add a module called sysconfig to the stdlib, that contains installation paths extracted from distutils/sysconfig and site.py, so the stdlib has only one place to handle those. This module will basically be the last spot to look for data in makefile and pyconfig.h, so maybe we could inject in it a condensed version of these files, in the form of a dict. (I'll send a mail on python-dev about this) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4359 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4049] IDLE does not open too
Martin v. Löwis mar...@v.loewis.de added the comment: Patricia, if you want to report a bug, please don't follow up to an existing, closed bug report. If you are just asking for help: delete the folder .idlerc and all of its files, and retry. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4049 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4359] at runtime, distutils uses buildtime files
Tarek Ziadé ziade.ta...@gmail.com added the comment: see http://mail.python.org/pipermail/python-dev/2009-November/094232.html (notice that the dependency in install can be removed easily because it just reads variables from sys and does not require to import sysconfig) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4359 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6906] Tkinter sets an unicode environment variable on win32
Michał Pasternak michal@gmail.com added the comment: This patch works OK for me (Vista Home Premium + Python 2.6), thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6906 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7326] SOLUTION pls? /usr/lib/python2.6/dist-packages/visual/__init__.py, line 59, in module import cvisual AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is read-onl
New submission from pablo veloz pvelo...@msn.com: sorry for my english, but how can i reparer that problem? help me pls thank. -- messages: 95273 nosy: pveloz severity: normal status: open title: SOLUTION pls? /usr/lib/python2.6/dist-packages/visual/__init__.py, line 59, in module import cvisual AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is read-only versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7326 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1368312] fix for scheme identification in urllib2?
Senthil Kumaran orsent...@gmail.com added the comment: This issue is Invalid. I am sorry that it had be open for so long without any explanation. The order in which the handlers are tried does not depend upon the way http_error_auth_reqed method is coded, but rather on the handler_order. In urllib2, we have handler_order set to 490 for digest and 500 for basic, which means that Digest will always be tried before Basic (Correctly so). If you have any server implementing both Basic and Digest (well,it is bad idea on the server part), you can try with any client, like firefox and see that Digest overrules Basic. Now, if you have two files (one under Basic Authentication ) and another under Digest Authentication configured, then it all boils down to adding both HTTPBasicAuthHandler and HTTPDigestAuthHandler to your OpenerDirector instance. The handler_order and opener instance will properly take care of opening the individual distinct requests with appropriate handlers. I tested it with the setup here and could not see any problem. I am closing this bug as Invalid. -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1368312 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6816] Provide CPython command line functionality via runpy module
Nick Coghlan ncogh...@gmail.com added the comment: Descoped idea to just provide runpy.run_path (filesystem path equivalent of runpy.run_module) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6816 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com