[issue18584] examples in email.policy doc are fu'd

2013-07-28 Thread rurpy

New submission from rurpy:

In the first example in the documentation for library module email.policy 
(http://docs.python.org/3/library/email.policy.html#module-email.policy):

  >>> from email import msg_from_binary_file
  >>> from email.generator import BytesGenerator
  >>> from subprocess import Popen, PIPE
  >>> with open('mymsg.txt', 'b') as f:
  ... msg = msg_from_binary_file(f)

line 1: The module is "message_from_binary_file", not "msg_from_binary_file"
line 4: The mode must be "rb", not "b".
line 5: Same module (mis-)name problem as line 1.

Then in following example...

  >>> import os
  >>> with open('converted.txt', 'wb') as f:
  ...   f.write(msg.as_string (policy=msg.policy.clone (linesep=os.linesep))

line 3: Ubnbalanced parens, .as_string() has no "policy" keyword arg.

Please note I am trying to figure out how to use the email module for the first 
time and the above errors are glaring.  There may be (probably are) other 
errors in the examples and in the text that I am unaware of -- I've made  no 
attempt to find any others.  I suggest that someone familiar with email module 
review this page more carefully.

--
assignee: docs@python
components: Documentation
messages: 193852
nosy: docs@python, rurpy2
priority: normal
severity: normal
status: open
title: examples in email.policy doc are fu'd
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15415] Add temp_dir() and change_cwd() to test.support

2013-07-28 Thread Nick Coghlan

Nick Coghlan added the comment:

I did see the Windows buildbot failure, but stopped scanning the log once I saw 
the intermittent test_signal failure :P

With the more granular API, test_startfile is a better fit for 
support.change_cwd, so we'll see how that goes on the Windows buildbots.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15415] Add temp_dir() and change_cwd() to test.support

2013-07-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a76693942de3 by Nick Coghlan in branch '3.3':
Attempt to fix #15415 on Windows
http://hg.python.org/cpython/rev/a76693942de3

New changeset b14308524cff by Nick Coghlan in branch 'default':
Merge #15415 Windows buildbot change from 3.3
http://hg.python.org/cpython/rev/b14308524cff

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18226] IDLE Unit test for FormatParagrah.py

2013-07-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Patch attached with current version. I noted in a comment that we should 
probably replace some of format_paragraph with textwrap.wrap.

The find_paragraph test works fine with the current text mock. I split one test 
method and will probably do more.

It could be considered a bug that find_paragraph included the hidden terminal 
\n when it finds the final line of the text and that line has no \n. Since that 
is a fairly unrealistic test case, we might do better to add \n on all test 
snippets. Certainly, adding \n\n is a bug.

I have the impression from what I have looked at so far is that triple quoted 
strings are not handled as they should be. I opened #18583 for enhancing the 
module beyond what we have done here.

--
components: +IDLE
Added file: http://bugs.python.org/file31070/18226FormatPara7.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18583] Idle: enhance FormatParagraph

2013-07-28 Thread Terry J. Reedy

New submission from Terry J. Reedy:

Writing tests for FormatParagraph.py #18226 revealed that it could use some 
improvements.

At minimum, some for format_paragraph should probably be replaced with 
textwrap.wrap (or the class) in order to handles double spacing after 
sentences. 

Find_paragraph should find the boundaries of triple-quoted strings.

The current end-of-text behavior of find_paragraph should perhaps be changed.

--
assignee: terry.reedy
messages: 193848
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: Idle: enhance FormatParagraph
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18538] `python -m dis ` should use argparse

2013-07-28 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +belopolsky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-28 Thread Guido van Rossum

Guido van Rossum added the comment:

> Raymond Hettinger added the comment:
>
> Nick, +1 from me if you want to make your edits and wrap this one up.

+1 from me too.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue4079] new urllib2.Request 'timeout' attribute needs to have a default

2013-07-28 Thread R. David Murray

R. David Murray added the comment:

Yes, this is a very good point.  (And your passing test is worthwhile, you are 
correct.)  

People are expected to be able to write handlers, so clearly the timeout API 
needs to be documented, if for no other reason than to keep a handler writer 
from stomping on the timeout attribute inappropriately.  

But there is a code smell to this "API", and I wonder if it is worth someone 
taking time to think it all through again to see if there is a better way to do 
it :(

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11152] pb in zipfile module

2013-07-28 Thread Damien M Calloway

Damien M Calloway added the comment:

I believe I have isolated the bug - I added a blank string to the SMALL TEST 
DATA list, since empty strings will not compress. Test now fails on lines 645 
and 663 when "extract" and "extract_all" assertions fail. This appears to 
replicate the issue reported.

--
keywords: +patch
Added file: http://bugs.python.org/file31069/test11152.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18226] IDLE Unit test for FormatParagrah.py

2013-07-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Some comments on patch 6:

1. tearDownClass was omitted, resulting in boxes left on the screen, at least 
when running in Idle with win7. I added this to the README.

I am also getting messages like "warning: callback failed in WindowList  : invalid command name ".5664.windows" in the Idle 
Shell window. The number of warnings is not deterministics.

I started idle with 'import idlelib.idle' in the console interpreter, I have 
also gotten messages in the console window but no more at the moment.

When I got these with test_text, they disappeared, as I remember, when I added 
root.destroy(). I do not know what is different this time.

I do not see the messages when I run in a console window.
python_d -m idlelib.idle_test.test_formatparagraph

2). The only code that needs to go in setUpClass is code that must only be 
executed when the tests are run rather than when the class is defined. All the 
string constants should be normal class code.
test_string = (
"\"\"\"this is a test of a reformat for a triple "
...

3) Only looking for space and tab for indent is correct. I was thinking that 
perhaps we should only include the first # in comment headers, in case someone 
does something like
...
# real comment line
but after looking at the implementation, I decided that anyone with such a 
block had better select the normal comment lines and omit the all #s line.

4) Formatting comments by stripping the header and reusing the format_paragraph 
is nice -- assuming that the latter can handle imbedded blank lines. The end of 
format_comments is flaky, but something that passes a test is way better than 
nothing. Format_paragraph looks like it could use improvement also, but I think 
we have improved FormatParagraph.py enough for now.

5. Like many, I prefer to use map with pre-existing functions and 
comprehensions for new expressions.

I am polishing the tests now and might commit later today.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-28 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Nick, +1 from me if you want to make your edits and wrap this one up.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-28 Thread Nick Coghlan

Nick Coghlan added the comment:

"with statements are good", basically.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15415] Add temp_dir() and change_cwd() to test.support

2013-07-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

-def temp_cwd(name='tempcwd', quiet=False, path=None):
+def temp_cwd(name='tempcwd', quiet=False):

Since this parameter removal was pushed, the Windows buildbots  consistently 
have this new error in this Windows-only test.

ERROR: test_empty (test.test_startfile.TestCase)
--
Traceback (most recent call last):
  File 
"C:\buildbot.python.org\3.3.kloth-win64\build\lib\test\test_startfile.py", line 
26, in test_empty
with support.temp_cwd(path=path.dirname(sys.executable)):

  File "C:\buildbot.python.org\3.3.kloth-win64\build\lib\contextlib.py", line 
115, in helper
return _GeneratorContextManager(func, *args, **kwds)
  File "C:\buildbot.python.org\3.3.kloth-win64\build\lib\contextlib.py", line 
37, in __init__
self.gen = func(*args, **kwds)
TypeError: temp_cwd() got an unexpected keyword argument 'path'

--
nosy: +terry.reedy
resolution: fixed -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c57b2a344097 by Terry Jan Reedy in branch '3.3':
Issue #18441: Remove check from test_text.py in 3.3,4 (already done in 2.7).
http://hg.python.org/cpython/rev/c57b2a344097

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-28 Thread Guido van Rossum

Guido van Rossum added the comment:

OK, forget I said anything about exceptions.  The language in Nick's patch is 
fine.

Regarding "break is bad", while I agree with Terry's recommendation, I think 
saying anything about this would be overreaching the scope of a style guide.  
We shouldn't give style lawyers more ammo to start holy wars.

I'm not sure I follow Nick's reference to "deterministic resource management to 
better cope with unexpected exceptions" -- is that an argument from the Go 
crowd? (Yawn.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Based on recent python-list posts, there is also 'break is bad' propaganda 
> going around. Perhaps we should say that loop-and-a-half with break is 
> preferred (or at least equally acceptable) to repeating code.

Sometimes yet one alternative can be used instead:

for value in iter(getvalue, stopvalue):
process(value)

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18563] No unit test for yiq to rgb and rgb to yiq converting functions

2013-07-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11619] On Windows, don't encode filenames in the import machinery

2013-07-28 Thread Drekin

Drekin added the comment:

Is there a chance this will be fixed at least in Python 4?

--
nosy: +Drekin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18575] Fixing tarfile._mode when using gzip via ":gz"

2013-07-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +Multivolume support in tarfile module
nosy: +serhiy.storchaka
stage:  -> patch review
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18577] lru_cache enhancement: lru_timestamp helper function

2013-07-28 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger
versions: +Python 3.4 -Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18112] PEP 442 implementation

2013-07-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


Added file: http://bugs.python.org/file31068/050c6d089164.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18112] PEP 442 implementation

2013-07-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Updated patch with the suggested changes, apart from a couple stylistic ones 
(waiting for your answer on these ones).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18582] PBKDF2 support

2013-07-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Please use the "y*" format, not "y#".
Also, I would lower-case "pbkdf2", just as we already lower-case "md5", "sha1", 
etc.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18472] Update PEP 8 to encourage modern conventions

2013-07-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Based on recent python-list posts, there is also 'break is bad' propaganda 
going around. Perhaps we should say that loop-and-a-half with break is 
preferred (or at least equally acceptable) to repeating code.

while True:
value = getvalue()
if not value:
break
process(value)

versus

value = getvalue()
while value
process(value)
value = getvalue()

The latter has the problem that the getvalue code can get out of synch, and 
indeed, given the alternative of writing it once, it is not obvious that it 
should be the same in the two places.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17134] Use Windows' certificate store for CA certs

2013-07-28 Thread Christian Heimes

Christian Heimes added the comment:

I guess I have to revise my patch and go throw Windows' crypto lookup 
functions... 

Automatic CA root certificate updates on Windows 
http://netsekure.org/2011/04/automatic-ca-root-certificate-updates-on-windows/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18582] PBKDF2 support

2013-07-28 Thread Christian Heimes

Changes by Christian Heimes :


Removed file: http://bugs.python.org/file31066/pbkdf2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18582] PBKDF2 support

2013-07-28 Thread Christian Heimes

Changes by Christian Heimes :


Added file: http://bugs.python.org/file31067/pbkdf2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18582] PBKDF2 support

2013-07-28 Thread Christian Heimes

New submission from Christian Heimes:

The patch is a proof of concept for PBKDF2 support for the OpenSSL variant of 
hashlib. It's a thin wrapper around PKCS5_PBKDF2_HMAC() and is deliberately 
designed as low level API with bytes and input and output types. High level 
wrappers can do the conversation and choose sensible values for salt, 
iterations and key length.

--
components: Extension Modules
files: pbkdf2.patch
keywords: patch
messages: 193832
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: PBKDF2 support
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31066/pbkdf2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18581] Duplicate test and missing class test in test_abc.py

2013-07-28 Thread Vajrasky Kok

New submission from Vajrasky Kok:

There are two classes in Lib/test/test_abc.py, which are TestABC and 
TestLegacyAPI.

Only TestABC is being unit tested.

Beside that TestLegacyAPI class has one duplicate test, which is 
test_abstractmethod_integration with TestABC class.

--
components: Tests
files: legacy_api_unit_test.txt
messages: 193831
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Duplicate test and missing class test in test_abc.py
versions: Python 3.4
Added file: http://bugs.python.org/file31065/legacy_api_unit_test.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18575] Fixing tarfile._mode when using gzip via ":gz"

2013-07-28 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +lars.gustaebel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18580] distutils compilers are unicode strings on OS X since Python 2.7.4

2013-07-28 Thread Ned Deily

Ned Deily added the comment:

Thanks for the analysis.  I'm consolidating this issue with Issue18580.

--
assignee: eric.araujo -> ned.deily
nosy: +ned.deily
resolution:  -> duplicate
stage:  -> committed/rejected
superseder:  -> _osx_support compiler_fixup

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18580] distutils compilers are unicode strings on OS X since Python 2.7.4

2013-07-28 Thread Ralf Schmitt

Changes by Ralf Schmitt :


--
nosy: +schmir

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18071] _osx_support compiler_fixup

2013-07-28 Thread Ralf Schmitt

Changes by Ralf Schmitt :


--
nosy: +schmir

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18071] _osx_support compiler_fixup

2013-07-28 Thread Alexey Borzenkov

Alexey Borzenkov added the comment:

Also, to reproduce it you have to temporarily move away your /usr/bin/cc and 
/usr/bin/clang, which then triggers the affected code path.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18071] _osx_support compiler_fixup

2013-07-28 Thread Alexey Borzenkov

Alexey Borzenkov added the comment:

I was unaware of this issue (which homebrew works around incorrectly), and 
because of this I created issue 18580. The problem is indeed with unicode 
strings which are coming from _read_output in _osx_support. This is probably 
because this code was merged from Python 3, which in Python 2 it shouldn't use 
decode('utf-8') on command output.

--
nosy: +Alexey.Borzenkov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18577] lru_cache enhancement: lru_timestamp helper function

2013-07-28 Thread Peter Santoro

Peter Santoro added the comment:

I updated my proposed lru_timestamp function with the following changes:

1) restricted refresh_interval to int type
2) updated doc string

Updated doc string follows:

def lru_timestamp(refresh_interval=60):
""" Return a timestamp string for @lru_cache decorated functions.

The returned timestamp is used as the value of an extra parameter
to @lru_cache decorated functions, allowing for more control over
how often cache entries are refreshed. The lru_timestamp function
should be called with the same refresh_interval value for a given
@lru_cache decorated function.  The returned timestamp is for the
benefit of the @lru_cache decorator and is normally not used by
the decorated function.

Positional arguments:
refresh_interval -- in minutes (default 60), values less than 1
are coerced to 1, values more than 1440 are
coerced to 1440

"""

--
Added file: http://bugs.python.org/file31064/lru.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18580] distutils compilers are unicode strings on OS X since Python 2.7.4

2013-07-28 Thread Alexey Borzenkov

New submission from Alexey Borzenkov:

A user reported getting a TypeError when building greenlet on OS X with Python 
2.7.4 built with homebrew. The TypeError happens because we subclass build_ext 
so before building extensions we can change compiler's compiler_so. The problem 
is that instead of a list it's a unicode string.

I couldn't reproduce the problem myself, but I traced it to the following:

In Lib/distutils/ccompiler.py, method CCompiler.set_executable, type check is 
only for str. So if set_executable is called with a unicode string is would not 
be turned into a list.

In Lib/_osx_support.py, function _read_output, the output is always decoded as 
utf-8 (why?). This function is used in _find_build_tool, which in turn is used 
in _find_appropriate_compiler, but only if it cannot find the compiler on the 
PATH (not sure when this could happen, when the user doesn't have Command Line 
Support installed?). Because of this compiler will be configured as a unicode 
string and this would probably mean no extensions can be built.

I this either _osx_support should be fixed to not decode output as utf-8, or 
set_executable should be fixed to test for basestring instead of str.

--
assignee: eric.araujo
components: Distutils
messages: 193826
nosy: Alexey.Borzenkov, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: distutils compilers are unicode strings on OS X since Python 2.7.4
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18578] Rename and document test.bytecode_helper as test.support.bytecode_helper

2013-07-28 Thread Nick Coghlan

Changes by Nick Coghlan :


--
assignee: ncoghlan -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18579] Dereference after NULL check in listobject.c merge_hi()

2013-07-28 Thread Christian Heimes

New submission from Christian Heimes:

Coverity Scan may have found an issue in listobject's merge code. I'm not 
familiar with the code so I don't know if ssb.value can be NULL here.

3. Condition "ssb.values != NULL", taking false branch
4. var_compare_op: Comparing "ssb.values" to null implies that "ssb.values" 
might be null.
1642if (ssb.values != NULL)
1643ssb.values = ms->a.values + nb - 1;

[...]

 
CID 715348 (#1 of 2): Dereference after null check (FORWARD_NULL)
18. var_deref_model: Passing "&ssb" to function "sortslice_copy_decr(sortslice 
*, sortslice *)", which dereferences null "ssb.values".
1711sortslice_copy_decr(&dest, &ssb);

http://hg.python.org/cpython/file/tip/Objects/listobject.c#l1711

--
components: Interpreter Core
messages: 193825
nosy: christian.heimes, haypo, tim_one
priority: normal
severity: normal
status: open
title: Dereference after NULL check in listobject.c merge_hi()
type: behavior
versions: Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15376] Refactor the test_runpy walk_package support code into a common location

2013-07-28 Thread Nick Coghlan

Nick Coghlan added the comment:

test.support is now a subpackage in both 3.3 and default, but 
test.support.package_helper still needs to be created (see comments on #15403)

--
versions: +Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15403] Refactor package creation support code into a common location

2013-07-28 Thread Nick Coghlan

Nick Coghlan added the comment:

Also, now that test.support is a subpackage, the helper should be a submodule 
of that (test.support.package_helper) rather than directly in the test 
directory.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15403] Refactor package creation support code into a common location

2013-07-28 Thread Nick Coghlan

Nick Coghlan added the comment:

As noted in #18576 and #18578, I'd like for these relocation patches to include 
the addition of documentation for the submodule in Doc/library/test.rst

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18578] Rename and document test.bytecode_helper as test.support.bytecode_helper

2013-07-28 Thread Nick Coghlan

New submission from Nick Coghlan:

test.bytecode_helper provides various utilities for sensibly testing bytecode 
generation. It isn't easy for CPython developers to discover, since it isn't 
documented and the file is mixed in with actual tests in the main test 
directory.

As discussed in #15494, it should be:

1. Moved from Lib/test/ to Lib/test/support (and imports in tests adjusted 
accordingly)
2. Documented in Doc/library/test.rst

This change only affects the default branch (since test.bytecode_helper is new 
in 3.4)

--
assignee: ncoghlan
messages: 193821
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Rename and document test.bytecode_helper as test.support.bytecode_helper
versions: Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18577] lru_cache enhancement: lru_timestamp helper function

2013-07-28 Thread Peter Santoro

New submission from Peter Santoro:

The attached proposed lru_timestamp function provides developers with more 
control over how often lru_cache entries are refreshed.  Doc string follows:

def lru_timestamp(refresh_interval=60):
""" Return a timestamp string for @lru_cache decorated functions.

The returned timestamp is used as the value of an extra parameter
to @lru_cache decorated functions, allowing for more control over
how often cache entries are refreshed. The lru_timestamp function
should be called with the same refresh_interval value for a given
lru_cache decorated function. 

Positional arguments:
refresh_interval -- 1-1440 minutes (default 60) as int or float

"""

Rationale:

Some functions have input parameters that rarely change, but yet return 
different results over time.  It would be nice to have a ready-made solution to 
force lru_cache entries to be refreshed at specified time intervals.

An common example is using a stable userid to read user information from a 
database.  By itself, the lru_cache decorator can be used to cache the user 
information and prevent unnecessary i/o.  However, if a given user's 
information is updated in the database, but the associated lru_cache entry has 
not yet been discarded, the application will be using stale data.  The 
lru_timestamp function is a simple, ready-made helper function that gives the 
developer more control over the age of lru_cache entries in such situations.

Sample usage:

@functools.lru_cache()
def user_info(userid, timestamp):
# expensive database i/o, but value changes over time
# the timestamp parameter is normally not used, it is
# for the benefit of the @lru_cache decorator
pass

# read user info from database, if not in cache or
# older than 120 minutes
info = user_info('johndoe', functools.lru_timestamp(120))

--
components: Library (Lib)
files: lru.py
messages: 193820
nosy: pe...@psantoro.net
priority: normal
severity: normal
status: open
title: lru_cache enhancement: lru_timestamp helper function
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file31063/lru.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18576] Rename and document test.script_helper as test.support.script_helper

2013-07-28 Thread Nick Coghlan

New submission from Nick Coghlan:

tests.script_helper provides various utilities for sensibly testing scripts in 
a subprocess. It isn't easy for CPython developers to discover, since it is 
isn't documented and the file is mixed in with actual tests in the main test 
directory.

As discussed in #15494, it should be:

1. Moved from Lib/test/ to Lib/test/support (and imports in tests adjusted 
accordingly)
2. Documented in Doc/library/test.rst

These changes should be made on both the 3.3 and default branches to avoid 
spurious merge conflicts.

--
assignee: docs@python
components: Documentation, Tests
messages: 193819
nosy: docs@python, ncoghlan
priority: normal
severity: normal
status: open
title: Rename and document test.script_helper as test.support.script_helper
type: enhancement
versions: Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15415] Add temp_dir() and change_cwd() to test.support

2013-07-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4f0034477ba9 by Nick Coghlan in branch '3.3':
Close #15415: Factor out temp dir helpers to test.support
http://hg.python.org/cpython/rev/4f0034477ba9

New changeset b20a10c97e08 by Nick Coghlan in branch 'default':
Merge #15415 from 3.3
http://hg.python.org/cpython/rev/b20a10c97e08

--
nosy: +python-dev
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18574] BaseHTTPRequestHandler.handle_expect_100() sends invalid response

2013-07-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +orsenthil
versions:  -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15494] Move test/support.py into a test.support subpackage

2013-07-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0b7ed24f7d33 by Nick Coghlan in branch '3.3':
Issue #15494: test.support is now a package rather than a module
http://hg.python.org/cpython/rev/0b7ed24f7d33

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15494] Move test/support.py into a test.support subpackage

2013-07-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 203a77e74aa7 by Nick Coghlan in branch 'default':
Close #15494: test.support is now a package rather than a module
http://hg.python.org/cpython/rev/203a77e74aa7

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17620] Python interactive console doesn't use sys.stdin for input

2013-07-28 Thread Drekin

Drekin added the comment:

Is there any chance the API will be added and used by python.exe?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13266] Add inspect.unwrap(f) to easily unravel "__wrapped__" chains

2013-07-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2aa6c1e35b8a by Nick Coghlan in branch 'default':
Close #13266: Add inspect.unwrap
http://hg.python.org/cpython/rev/2aa6c1e35b8a

--
nosy: +python-dev
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18575] Fixing tarfile._mode when using gzip via ":gz"

2013-07-28 Thread Eduardo Robles Elvira

Eduardo Robles Elvira added the comment:

Fixing  gzip.patch, it was using basestring (python2) instead of str

--
Added file: http://bugs.python.org/file31062/gzip.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue18575] Fixing tarfile._mode when using gzip via ":gz"

2013-07-28 Thread Eduardo Robles Elvira

Changes by Eduardo Robles Elvira :


Removed file: http://bugs.python.org/file31061/gzip.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18575] Fixing tarfile._mode when using gzip via ":gz"

2013-07-28 Thread Eduardo Robles Elvira

New submission from Eduardo Robles Elvira:

A TarFile object constructor accepts a fileobj argument. When this argument is 
set and it has a "mode" property, tarfile._mode is blindly copied from there. 
Otherwise, mode is set using the mode argument in the constructor.

This usually works, but in the case where fileobj is a gzip.GzipFile, the 
"mode" property is not a string like "rb" or "wb" but an integer, which is not 
expected in TarFile. 

This has not been noticed before probably because the TarFile._mode property is 
usually unused internally, but in my case it's a problem when using it together 
with tarfile multivolume mode provided in issue #18321.

--
components: Library (Lib)
files: gzip.patch
keywords: patch
messages: 193812
nosy: edulix
priority: normal
severity: normal
status: open
title: Fixing tarfile._mode when using gzip via ":gz"
versions: Python 3.4
Added file: http://bugs.python.org/file31061/gzip.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18321] Multivolume support in tarfile module

2013-07-28 Thread Eduardo Robles Elvira

Eduardo Robles Elvira added the comment:

Sure, I will fill it out. But is it required?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com