[issue26360] Deadlock in thread.join

2016-02-16 Thread Mark Dickinson
Mark Dickinson added the comment: > I'm not sure that "Waiting for the GIL" line is reliable Right; I was interpreting that line more as "I don't have the GIL at the moment", which I think applies to all threads, including the main thread. It's pretty clear that threads 2-5 really are waiting

[issue26280] ceval: Optimize list

2016-02-16 Thread STINNER Victor
STINNER Victor added the comment: I suggest to try to inline PyList_GetItem: use PyList_GET_ITEM and raise the exception manually if needed. I'm not sure that it's ok to add PyLong_AsSize_t() to the slow path. Copy the code in each if? A macro can help. -- title: ceval: Optimize

Re: Will file be closed automatically in a "for ... in open..." statement?

2016-02-16 Thread Steven D'Aprano
On Wednesday 17 February 2016 15:04, jf...@ms4.hinet.net wrote: > Thanks for these detailed explanation. Both statements will close file > automatically sooner or later and, when considering the exceptions, "with" > is better. Hope my understanding is right. > > But, just curious, how do you

Re: I m facing some problem while opening the interpreter. how can I resolve the issue?

2016-02-16 Thread Steven D'Aprano
On Wednesday 17 February 2016 06:55, Chinmaya Choudhury wrote: > Please guide me. > #Chinmay > > Sent from Mail for Windows 10 How can we help you when we don't know what problem you have? Is the computer turned on? Is the mouse plugged in? Are you double-clicking the icon on the desktop?

threading - Doug Hellman stdlib book, Timer() subclassing etc

2016-02-16 Thread Veek. M
In Doug Hellman's book on the stdlib, he does: import threading import logging logging.basicConfig(level=logging.DEBUG, format=’(%(threadName)-10s) %(message)s’, ) class MyThreadWithArgs(threading.Thread): def __init__(self, group=None, target=None, name=None, args=(),

Re: Will file be closed automatically in a "for ... in open..." statement?

2016-02-16 Thread Raspberry Aether
On 02/16/2016 11:04 PM, jf...@ms4.hinet.net wrote: > Thanks for these detailed explanation. Both statements will close file > automatically sooner or later and, when considering the exceptions, "with" is > better. Hope my understanding is right. > > But, just curious, how do you know the "for"

Re: Will file be closed automatically in a "for ... in open..." statement?

2016-02-16 Thread Chris Angelico
On Wed, Feb 17, 2016 at 3:04 PM, wrote: > Thanks for these detailed explanation. Both statements will close file > automatically sooner or later and, when considering the exceptions, "with" is > better. Hope my understanding is right. > > But, just curious, how do you know

Re: Will file be closed automatically in a "for ... in open..." statement?

2016-02-16 Thread jfong
Thanks for these detailed explanation. Both statements will close file automatically sooner or later and, when considering the exceptions, "with" is better. Hope my understanding is right. But, just curious, how do you know the "for" will do it? I can't find any document about it from every

[issue26280] ceval: Optimize list[int] (subscript) operation similarly to CPython 2.7

2016-02-16 Thread Zach Byrne
Zach Byrne added the comment: Here's a patch that looks likes Victor's from the duplicate, but with tuples covered as well. I ran some straight forward micro benchmarks but haven't bothered running the benchmark suite yet. Unsurprisingly, optimized paths are faster, and the others take a

[issue26360] Deadlock in thread.join

2016-02-16 Thread STINNER Victor
STINNER Victor added the comment: >> lock=0x0 looks suspicious. > Agreed. I think that *could* possibly be a consequence of the earlier > multiple GILs, though I haven't figured out exactly how yet. Don't trust gdb output when Python is compiled in release mode (with -O3). gdb output is only

[issue26360] Deadlock in thread.join

2016-02-16 Thread STINNER Victor
STINNER Victor added the comment: > I've also not yet managed to reproduce on Python 3, but I haven't tried that > hard. I suspect it's a Python 2-only problem, though. Python 3.2 got a new GIL and many bugs related to the GIL were fixed in Python 3 too. The "workaround" is to use Python 3,

[issue26372] Popen.communicate not ignoring BrokenPipeError

2016-02-16 Thread Memeplex
New submission from Memeplex: When not using a timeout, communicate will raise a BrokenPipeError if the command returns an error code. For example: sp = subprocess.Popen('cat --not-an-option', shell=True, stdin=subprocess.PIPE) time.sleep(.2) sp.communicate(b'hi\n') This isn't consistent with

[issue26360] Deadlock in thread.join

2016-02-16 Thread STINNER Victor
STINNER Victor added the comment: debug-build-stacktrace.txt: * Thread 1 is waiting on threading_hang.py:21: thread.join() * Thread 2-6 (5 threads) are waiting for the GIL The thread 1 is not supposed to hold the GIL: thread.join() is implemented by lock_PyThread_acquire_lock() at

[issue26360] Deadlock in thread.join

2016-02-16 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___

Re: Make a unique filesystem path, without creating the file

2016-02-16 Thread Alan Bawden
Ben Finney writes: > Cameron Simpson writes: > >> I've been watching this for a few days, and am struggling to >> understand your use case. > > Yes, you're not alone. This surprises me, which is why I'm persisting. > >> Can you elaborate with a

[issue26347] BoundArguments.apply_defaults doesn't handle empty arguments

2016-02-16 Thread Frederick Wagner
Frederick Wagner added the comment: All right, looks like I have the asterisk now! Looking forward to officially contributing to the Python standard library :) -- ___ Python tracker

[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-16 Thread Manuel Jacob
Changes by Manuel Jacob : Added file: http://bugs.python.org/file41938/relimport-3.6.patch ___ Python tracker ___

[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-16 Thread Manuel Jacob
Changes by Manuel Jacob : -- keywords: +patch Added file: http://bugs.python.org/file41937/relimport-3.5.patch ___ Python tracker

[issue25671] Fix venv activate.fish to maintain $status

2016-02-16 Thread Nathan West
Nathan West added the comment: Not quite, no. The issue looks like this: user@host ~/test> python3 -mvenv env user@host ~/test> true user@host ~/test> false user@host ~/test [1]> source env/bin/activate.fish (env) user@host ~/test> true (env) user@host ~/test> false

Re: Not intalling

2016-02-16 Thread Ben Finney
SoNu KuMaR writes: > I'm trying to install the latest version of python . First time it > didn't install successfully ,i tried again now it have installed but > not working. What exactly did you try? What details about the host can you describe so we know what may be

Not intalling

2016-02-16 Thread SoNu KuMaR
I'm trying to install the latest version of python . First time it didn't install successfully ,i tried again now it have installed but not working. I'm sending screenshot and log file. I tried reinstallation again and again but result is same. --

Passing data across callbacks in ThreadPoolExecutor

2016-02-16 Thread Joseph L. Casale
What is the pattern for chaining execution of tasks with ThreadPoolExecutor? Callbacks is not an adequate facility as each task I have will generate new output. Thanks, jlc -- https://mail.python.org/mailman/listinfo/python-list

Re: [Glitch?] Python has just stopped working

2016-02-16 Thread eryk sun
On Tue, Feb 16, 2016 at 10:19 AM, Theo Hamilton wrote: > Whenever I run python (3.5), I get the following message: > > Fatal Python error: Py_initialize: unable to load the file system codec > ImportError: No module named 'encodings' > > Current thread 0x2168 (most

[issue26371] asynchat.async_chat and asyncore.dispatcher_with_send are not thread-safe

2016-02-16 Thread Guido van Rossum
Guido van Rossum added the comment: I don't believe the original issue is a bug. There is nothing in the docs for asyncore or asynchat that suggests they would be thread-safe. -- resolution: -> not a bug status: open -> closed ___ Python tracker

[issue26371] asynchat.async_chat and asyncore.dispatcher_with_send are not thread-safe

2016-02-16 Thread STINNER Victor
STINNER Victor added the comment: asynchat is now deprecated in favor of asyncio. Almost all asyncio functions are not thread-safe, it's now well documented, see the general info: https://docs.python.org/dev/library/asyncio-dev.html#concurrency-and-multithreading If we do something, I suggest

[issue26371] asynchat.async_chat and asyncore.dispatcher_with_send are not thread-safe

2016-02-16 Thread NGG
New submission from NGG: The initiate_send() method in both asynchat.async_chat and asyncore.dispatcher_with_send is not a thread-safe function, but it can be called from multiple threads. For example if asyncore.loop() runs in a background thread, and the main thread sends a message then

Re: I m facing some problem while opening the interpreter. how can I resolve the issue?

2016-02-16 Thread Igor Korot
On Tue, Feb 16, 2016 at 2:55 PM, Chinmaya Choudhury wrote: > Please guide me. > #Chinmay Dear Cousin Muscle, I have a serious trouble with Tom. Need you help at once, Jerry. (C) > > Sent from Mail for Windows 10 > > -- >

Re: I m facing some problem while opening the interpreter. how can I resolve the issue?

2016-02-16 Thread Alister
On Wed, 17 Feb 2016 01:25:52 +0530, Chinmaya Choudhury wrote: > Please guide me. > #Chinmay > > Sent from Mail for Windows 10 open it correctly -- The temperature of the aqueous content of an unremittingly ogled culinary vessel will not achieve 100 degrees on the Celsius scale. --

Re: I m facing some problem while opening the interpreter. how can I resolve the issue?

2016-02-16 Thread Mark Lawrence
On 16/02/2016 19:55, Chinmaya Choudhury wrote: Please guide me. #Chinmay Sent from Mail for Windows 10 Please read http://catb.org/~esr/faqs/smart-questions.html and possibly http://www.sscce.org/, then try asking again. -- My fellow Pythonistas, ask not what our language can do for you,

Re: [Glitch?] Python has just stopped working

2016-02-16 Thread Christian Gollwitzer
Am 16.02.16 um 17:19 schrieb Theo Hamilton: I woke up two days ago to find out that python literally won't work any more. I have looked everywhere, asked multiple Stack Overflow questions, and am ready to give up. Whenever I run python (3.5), I get the following message: Fatal Python error:

[Glitch?] Python has just stopped working

2016-02-16 Thread Theo Hamilton
I woke up two days ago to find out that python literally won't work any more. I have looked everywhere, asked multiple Stack Overflow questions, and am ready to give up. Whenever I run python (3.5), I get the following message: Fatal Python error: Py_initialize: unable to load the file system

I m facing some problem while opening the interpreter. how can I resolve the issue?

2016-02-16 Thread Chinmaya Choudhury
Please guide me. #Chinmay Sent from Mail for Windows 10 -- https://mail.python.org/mailman/listinfo/python-list

Re: Make a unique filesystem path, without creating the file

2016-02-16 Thread Ben Finney
Steven D'Aprano writes: > On Tue, 16 Feb 2016 04:56 pm, Ben Finney wrote: > > > names = tempfile._get_candidate_names() > > I'm not sure that calling a private function of the tempfile module is > better than calling a deprecated function. Agreed, which is why I'm

Re: Make a unique filesystem path, without creating the file

2016-02-16 Thread Ben Finney
Oscar Benjamin writes: > If you're going to patch open to return a fake file when asked to open > fake_file_path why do you care whether there is a real file of that > name? I don't, and have been saying explicitly many times in this thread that I do not care whether

Re: Multiple Assignment a = b = c

2016-02-16 Thread Terry Reedy
On 2/16/2016 7:46 AM, srinivas devaki wrote: Hi, a = b = c as an assignment doesn't return anything, i ruled out a = b = c as chained assignment, like a = (b = c) SO i thought, a = b = c is resolved as a, b = [c, c] https://docs.python.org/3/reference/simple_stmts.html#assignment-statements

[issue26336] Expose regex bytecode as attribute of compiled pattern object

2016-02-16 Thread Paul Moore
Changes by Paul Moore : -- keywords: +easy ___ Python tracker ___ ___ Python-bugs-list

[issue13276] bdist_wininst-created installer does not run the postinstallation script when uninstalling

2016-02-16 Thread francisco
francisco added the comment: I believe that this bug—which I reported in 2011—is not correctly tagged, what may explain why it has not been fixed yet. Despite the fact that the original issue report contains a script to reproduce the bug and that msg148674 contains a patch to fix the issue

[issue14597] Cannot unload dll in ctypes until script exits

2016-02-16 Thread Mark Mikofski
Mark Mikofski added the comment: Snippets of "proprietary" code `setup.py` -- # run clean or build libraries if they don't exist if 'clean' in sys.argv: try: os.remove(os.path.join(LIB_DIR, SOLPOSAM_LIB_FILE)) os.remove(os.path.join(LIB_DIR, SPECTRL2_LIB_FILE))

Re: asyncio - run coroutine in the background

2016-02-16 Thread Robin Becker
On 16/02/2016 17:15, Marko Rauhamaa wrote: Marko Rauhamaa : Sure: Sorry for the multiple copies. Marko I thought perhaps background jobs were sending them :) -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list

Re: Make a unique filesystem path, without creating the file

2016-02-16 Thread Steven D'Aprano
On Tue, 16 Feb 2016 04:56 pm, Ben Finney wrote: > An example:: > > import io > import tempfile > names = tempfile._get_candidate_names() I'm not sure that calling a private function of the tempfile module is better than calling a deprecated function. > def

Re: asyncio - run coroutine in the background

2016-02-16 Thread Marko Rauhamaa
"Frank Millman" : > I would love to drive the database asynchronously, but of the three > databases I use, only psycopg2 seems to have asyncio support. Yes, asyncio is at its infancy. There needs to be a moratorium on blocking I/O. Marko --

Re: asyncio - run coroutine in the background

2016-02-16 Thread Marko Rauhamaa
Steven D'Aprano : > On Wed, 17 Feb 2016 01:17 am, Marko Rauhamaa wrote: > >> Ok, yes, but those "background tasks" monopolize the CPU once they are >> scheduled to run. > > Can you show some code demonstrating this? Sure:

Re: asyncio - run coroutine in the background

2016-02-16 Thread Marko Rauhamaa
Marko Rauhamaa : > Sure: Sorry for the multiple copies. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio - run coroutine in the background

2016-02-16 Thread Marko Rauhamaa
Steven D'Aprano : > On Wed, 17 Feb 2016 01:17 am, Marko Rauhamaa wrote: > >> Ok, yes, but those "background tasks" monopolize the CPU once they are >> scheduled to run. > > Can you show some code demonstrating this? Sure:

Re: asyncio - run coroutine in the background

2016-02-16 Thread Marko Rauhamaa
Steven D'Aprano : > On Wed, 17 Feb 2016 01:17 am, Marko Rauhamaa wrote: > >> Ok, yes, but those "background tasks" monopolize the CPU once they are >> scheduled to run. > > Can you show some code demonstrating this? Sure:

Re: asyncio - run coroutine in the background

2016-02-16 Thread Marko Rauhamaa
Steven D'Aprano : > On Wed, 17 Feb 2016 01:17 am, Marko Rauhamaa wrote: > >> Ok, yes, but those "background tasks" monopolize the CPU once they >> are scheduled to run. > > Can you show some code demonstrating this? Sure:

[issue25713] Setuptools included with 64-bit Windows installer is outdated

2016-02-16 Thread Paul Moore
Paul Moore added the comment: Just to clarify, it's intended that you simply "python -m pip install --upgrade pip setuptools" to get the latest version. -- nosy: +paul.moore ___ Python tracker

[issue24911] Context manager of socket.socket is not documented

2016-02-16 Thread Yury Selivanov
Yury Selivanov added the comment: The patch looks good. It would also be cool if you can add a short code snippet somewhere: sock = socket.socket() with sock: sock.bind(('127.0.0.1', 8080)) sock.listen() ... -- nosy: +yselivanov

Re: Multiple Assignment a = b = c

2016-02-16 Thread srinivas devaki
On Tue, Feb 16, 2016 at 6:35 PM, Sven R. Kunze wrote: > > First, the rhs is evaluated. > Second, the lhs is evaluated from left to right. Great, I will remember these two lines :) On Tue, Feb 16, 2016 at 8:46 PM, Steven D'Aprano wrote: > _temp = c > a =

Re: asyncio - run coroutine in the background

2016-02-16 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmqmie4groqnyvhwahcn2mwqeyqxt5kvfivotrhqy-s...@mail.gmail.com... On Wed, Feb 17, 2016 at 2:21 AM, Frank Millman wrote: > I would love to drive the database asynchronously, but of the three > databases I use, only psycopg2 seems

Re: asyncio - run coroutine in the background

2016-02-16 Thread Chris Angelico
On Wed, Feb 17, 2016 at 2:21 AM, Frank Millman wrote: > I would love to drive the database asynchronously, but of the three > databases I use, only psycopg2 seems to have asyncio support. As my > home-grown solution (using queues) seems to be working well so far, I am >

Re: asyncio - run coroutine in the background

2016-02-16 Thread Steven D'Aprano
On Wed, 17 Feb 2016 01:17 am, Marko Rauhamaa wrote: > Ok, yes, but those "background tasks" monopolize the CPU once they are > scheduled to run. Can you show some code demonstrating this? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio - run coroutine in the background

2016-02-16 Thread Frank Millman
"Kevin Conway" wrote in message news:CAKF=+dhXZ=yax8stawr_gjx3tg8yujprjg-7ym2_brv2kxm...@mail.gmail.com... > My background task does take a long time to run - about 10 seconds - but > most of that time is spent waiting for database responses, which is > handled > in another thread.

Re: Multiple Assignment a = b = c

2016-02-16 Thread Steven D'Aprano
On Tue, 16 Feb 2016 11:46 pm, srinivas devaki wrote: > Hi, > > a = b = c > > as an assignment doesn't return anything, i ruled out a = b = c as > chained assignment, like a = (b = c) > SO i thought, a = b = c is resolved as > a, b = [c, c] That is one way of thinking of it. A better way would

Re: asyncio - run coroutine in the background

2016-02-16 Thread Kevin Conway
> Ok, yes, but those "background tasks" monopolize the CPU once they are scheduled to run. This is true if the coroutines are cpu bound. If that is the case then a coroutine is likely the wrong choice for that code to begin with. Coroutines, in asyncio land, are primarily designed for io bound

JyNI 2.7-alpha.3 released!

2016-02-16 Thread Stefan Richthofer
Following up on the recent release of Jython 2.7.1 beta 3 I am proud to announce the release of JyNI 2.7-alpha.3. Take a look at jyni.org or go directly to the release: https://github.com/Stewori/JyNI/releases/tag/v2.7-alpha.3 Binaries are provided for target platforms JyNI is tested on. It

Re: asyncio - run coroutine in the background

2016-02-16 Thread Frank Millman
"Marko Rauhamaa" wrote in message news:87d1rwpwo2@elektro.pacujo.net... Kevin Conway : > If you're handling coroutines there is an asyncio facility for > "background tasks". The ensure_future [1] will take a coroutine, > attach it to a Task, and return a future

[issue14597] Cannot unload dll in ctypes until script exits

2016-02-16 Thread Brian Curtin
Changes by Brian Curtin : -- nosy: -brian.curtin ___ Python tracker ___ ___

Re: asyncio - run coroutine in the background

2016-02-16 Thread Marko Rauhamaa
Kevin Conway : > If you're handling coroutines there is an asyncio facility for > "background tasks". The ensure_future [1] will take a coroutine, > attach it to a Task, and return a future to you that resolves when the > coroutine is complete. Ok, yes, but those

[issue26370] shelve filename inconsistent between platforms

2016-02-16 Thread Dima Tisnek
New submission from Dima Tisnek: shelve.open("foo.db") creates "foo.db" on Linux and "foo.db.db" on OSX. Something to that extent is even documented: """d = shelve.open(filename) # open, with (g)dbm filename -- no suffix""" and """As a side-effect, an extension may be added to the filename and

Re: asyncio - run coroutine in the background

2016-02-16 Thread Frank Millman
"Kevin Conway" wrote in message news:CAKF=+dim8wzprvm86_v2w5-xsopcchvgm0hy8r4xehdyzy_...@mail.gmail.com... If you're handling coroutines there is an asyncio facility for "background tasks". The ensure_future [1] will take a coroutine, attach it to a Task, and return a future to you that

Re: extending PATH on Windows?

2016-02-16 Thread Thorsten Kampe
* Ulli Horlacher (Tue, 16 Feb 2016 12:38:44 + (UTC)) By the way: there is a script called `win_add2path.py` in your Python distribution which "is a simple script to add Python to the Windows search path. It modifies the current user (HKCU) tree of the registry.". That should do most of

Re: extending PATH on Windows?

2016-02-16 Thread Thorsten Kampe
* Ulli Horlacher (Tue, 16 Feb 2016 12:38:44 + (UTC)) > > Thorsten Kampe wrote: > > * Ulli Horlacher (Tue, 16 Feb 2016 08:30:59 + (UTC)) > > > I need to extend the PATH environment variable on Windows. > > > > 1. Add the path component yourself into

[issue26369] doc for unicode.decode and str.encode is unnecessarily confusing

2016-02-16 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti ___ Python tracker ___ ___

Re: asyncio - run coroutine in the background

2016-02-16 Thread Kevin Conway
If you're handling coroutines there is an asyncio facility for "background tasks". The ensure_future [1] will take a coroutine, attach it to a Task, and return a future to you that resolves when the coroutine is complete. The coroutine you schedule with that function will not cause your current

Re: extending PATH on Windows?

2016-02-16 Thread eryk sun
On Tue, Feb 16, 2016 at 2:30 AM, Ulli Horlacher wrote: > > So far, I use: > >system('setx PATH "%PATH%;'+bindir+'"') > > The problem: In a new process (cmd.exe) PATH contains a lot of double > elements. As far as I have understood, Windows builds the PATH >

Re: Multiple Assignment a = b = c

2016-02-16 Thread Sven R. Kunze
On 16.02.2016 14:05, Sven R. Kunze wrote: Hi Srinivas, I think the tuple assignment you showed basically nails it. First, the rhs is evaluated. Second, the lhs is evaluated from left to right. Completely wrong? Best, Sven As you mentioned swapping. The following two statements do the same

Re: Multiple Assignment a = b = c

2016-02-16 Thread Sven R. Kunze
Hi Srinivas, On 16.02.2016 13:46, srinivas devaki wrote: Hi, a = b = c as an assignment doesn't return anything, i ruled out a = b = c as chained assignment, like a = (b = c) SO i thought, a = b = c is resolved as a, b = [c, c] at-least i fixed in my mind that every assignment like

[issue26369] doc for unicode.decode and str.encode is unnecessarily confusing

2016-02-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Perhaps you could suggest a specific change to the docstrings for str.encode and unicode.decode? (BTW, I presume you are aware that the equivalent of (bytes)str.encode and unicode.decode are gone in Python 3?) -- nosy: +steven.daprano

Installation error, compiling from source on Oracle Linux

2016-02-16 Thread John D. Gwinner
I'm installing an app that requires Carbon and some other Python 2.7 features. The version of Oracle Linux we're using comes with 2.6. I've read that it is not a good idea to directly update the O/S as it "may break things" so I'm doing make altinstall. I've downloaded Python-2.7.11 Downloaded

Multiple Assignment a = b = c

2016-02-16 Thread srinivas devaki
Hi, a = b = c as an assignment doesn't return anything, i ruled out a = b = c as chained assignment, like a = (b = c) SO i thought, a = b = c is resolved as a, b = [c, c] at-least i fixed in my mind that every assignment like operation in python is done with references and then the references

Re: Unable to insert data into MongoDB.

2016-02-16 Thread Arjun Srivatsa
Thanks a lot. Will implement that. Although I am able to do using just 2 scripts as well. On Monday, February 15, 2016 at 5:34:08 PM UTC+1, Peter Otten wrote: > Arjun Srivatsa wrote: > > > Hi Peter. > > > > Thank you for the reply. > > > > This is the read_server code: > > > > import socket

Re: extending PATH on Windows?

2016-02-16 Thread Ulli Horlacher
Thorsten Kampe wrote: > * Ulli Horlacher (Tue, 16 Feb 2016 08:30:59 + (UTC)) > > I need to extend the PATH environment variable on Windows. > > 1. Add the path component yourself into HKEY_CURRENT_USER and make > sure it's not there already (pure Python).

Re: extending PATH on Windows?

2016-02-16 Thread Thorsten Kampe
* Ulli Horlacher (Tue, 16 Feb 2016 08:30:59 + (UTC)) > I need to extend the PATH environment variable on Windows. > > So far, I use: > >system('setx PATH "%PATH%;'+bindir+'"') > > The problem: In a new process (cmd.exe) PATH contains a lot of double > elements. As far as I have

[issue23718] strptime() can produce invalid date with negative year day

2016-02-16 Thread Tamás Bence Gedai
Tamás Bence Gedai added the comment: I've added a new patch, it uses an other way to calculate the number of days in a given year. I updated the tests, so now it doesn't fail, I also added some extra test cases to test leap years. -- Added file:

[issue26369] doc for unicode.decode and str.encode is unnecessarily confusing

2016-02-16 Thread Ben Spiller
New submission from Ben Spiller: It's well known that lots of people struggle writing correct programs using non-ascii strings in python 2.x, but I think one of the main reasons for this could be very easily fixed with a small addition to the documentation for str.encode and unicode.decode,

[issue24911] Context manager of socket.socket is not documented

2016-02-16 Thread Berker Peksag
Berker Peksag added the comment: socket-context.patch looks good to me. There is no need to add a NEWS entry for this. -- nosy: +berker.peksag stage: patch review -> commit review versions: -Python 3.4 ___ Python tracker

[issue26366] Use “.. versionadded” over “.. versionchanged” where appropriate

2016-02-16 Thread Berker Peksag
Berker Peksag added the comment: I agree with Georg and Ezio. We should update the devguide. Tony, would you like to propose a patch? The repo is at https://hg.python.org/devguide -- nosy: +berker.peksag ___ Python tracker

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-16 Thread Mathieu Dupuy
Mathieu Dupuy added the comment: OK, I know I post a lot, but this one should be the good one: * recoded from scratch. Apart the algorithm, nothing come from Django anymore. * help me fill the docstring, I'm not inspired * datetime has few tests since it use the implementation of

Re: Will file be closed automatically in a "for ... in open..." statement?

2016-02-16 Thread Terry Reedy
On 2/16/2016 3:39 AM, jf...@ms4.hinet.net wrote: I know with open('foo.txt') as f: ...do something... will close the file automatically when the "with" block ends. I also saw codes in a book: for line in open('foo.txt'): ...do something... Some books were

Re: Will file be closed automatically in a "for ... in open..." statement?

2016-02-16 Thread Cameron Simpson
On 16Feb2016 00:39, jf...@ms4.hinet.net wrote: I know with open('foo.txt') as f: ...do something... will close the file automatically when the "with" block ends. Yes, because open is a context manager - they're great for reliably tidying up in the face of

Re: Will file be closed automatically in a "for ... in open..." statement?

2016-02-16 Thread Chris Angelico
On Tue, Feb 16, 2016 at 7:39 PM, wrote: > I know > > with open('foo.txt') as f: > ...do something... > > will close the file automatically when the "with" block ends. > > I also saw codes in a book: > > for line in open('foo.txt'): > ...do

[issue14597] Cannot unload dll in ctypes until script exits

2016-02-16 Thread Eryk Sun
Eryk Sun added the comment: As to not being able to delete a loaded DLL on Windows, a workaround that may help in some instances is to rename it to a temporary name on the same volume. This is useful for upgrading in place. If you have admin privileges you can even flag the renamed DLL to be

[issue14597] Cannot unload dll in ctypes until script exits

2016-02-16 Thread Eryk Sun
Eryk Sun added the comment: The _ctypes extension module provides dlclose on POSIX and FreeLibrary on Windows. For the reasons already stated in this issue, ctypes should not automatically call these functions, but maybe they should be documented and imported to the ctypes module instead of

[issue23718] strptime() can produce invalid date with negative year day

2016-02-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could you provide a patch? See also my comment on Rietveld (the "review" link). -- ___ Python tracker ___

Will file be closed automatically in a "for ... in open..." statement?

2016-02-16 Thread jfong
I know with open('foo.txt') as f: ...do something... will close the file automatically when the "with" block ends. I also saw codes in a book: for line in open('foo.txt'): ...do something... but it didn't mention if the file will be closed automatically or not when

Re: Make a unique filesystem path, without creating the file

2016-02-16 Thread Oscar Benjamin
On 16 Feb 2016 05:57, "Ben Finney" wrote: > > Cameron Simpson writes: > > > I've been watching this for a few days, and am struggling to > > understand your use case. > > Yes, you're not alone. This surprises me, which is why I'm persisting. > > > Can

extending PATH on Windows?

2016-02-16 Thread Ulli Horlacher
I need to extend the PATH environment variable on Windows. So far, I use: system('setx PATH "%PATH%;'+bindir+'"') The problem: In a new process (cmd.exe) PATH contains a lot of double elements. As far as I have understood, Windows builds the PATH environment variable from a system component

[issue14597] Cannot unload dll in ctypes until script exits

2016-02-16 Thread Eryk Sun
Eryk Sun added the comment: > My setup.py creates a .dll then later loads the dll for testing > using ctypes. Subsequent runs of setup.py that would force > rebuilding the .dll attempt to delete the old dll first if it > exists, but I get permission denied. > > Oddly, if I put the load