[issue34319] Clarify pathlib.Path("filepath").read_text()

2018-08-26 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

Marking this bug as fixed via https://github.com/python/cpython/pull/8645

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue15045] Make textwrap.dedent() consistent with str.splitlines(True) and str.strip()

2018-08-26 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

Hey Nick, Serhiy

The patch is up for your review. Any updates on this?

--

___
Python tracker 

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



[issue34361] An error should be returned when there are spaces in between function name and parameters

2018-08-26 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

Hi,

I agree that it can break backward compatibility. But maybe we can add some 
sort of warning message?

The entire motive of this is to get new folks to understand how a function is 
ideally defined and called.

--

___
Python tracker 

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



[issue32968] Fraction modulo infinity should behave consistently with other numbers

2018-08-26 Thread Elias Zamaria


Elias Zamaria  added the comment:

I updated my GitHub username. For the record, it used to be mikez302, and now 
it is elias6.

--

___
Python tracker 

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



[issue34514] assertEqual doesn't use maxDiff when comparing dictionaries

2018-08-26 Thread Prudvi RajKumar Maddala


Prudvi RajKumar Maddala  added the comment:

Hello Victor, can you tell me what is 'maxDiff'? Can you give me a simple 
example of expected output and actual output by taking a simple dictionary?

Thanks

--
nosy: +prudvinit

___
Python tracker 

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



[issue34514] assertEqual doesn't use maxDiff when comparing dictionaries

2018-08-26 Thread Victor Engmark


New submission from Victor Engmark :

According to the documentation `assertDictEqual()` "will be used by default to 
compare dictionaries in calls to assertEqual()." Great, since `maxDiff` applies 
to assertDictEqual(). However, `maxDiff` doesn't apply to `assertEqual()` when 
comparing dictionaries.

--
components: Tests
messages: 324140
nosy: Victor Engmark2
priority: normal
severity: normal
status: open
title: assertEqual doesn't use maxDiff when comparing dictionaries
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue30858] Keyword can't be an expression?

2018-08-26 Thread Nick Coghlan


Nick Coghlan  added the comment:

The current error message is also outright incorrect, since simple names *are* 
valid expressions - the actual problem being reported is that binary 
expressions (veky's case) and strings (my case) *aren't* identifiers.

--

___
Python tracker 

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



[issue30858] Keyword can't be an expression?

2018-08-26 Thread Nick Coghlan


Nick Coghlan  added the comment:

I just ran into this, and found the existing error message *incredibly* 
confusing. My immediate reaction was "There's no keyword in that line, what are 
you complaining about?".

An error message that said "Keyword argument name must be an identifier" would 
have been *far* more useful, and far less confusing.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue34513] test_multiprocessing_spawn fails on x86 Windows7 3.7 buildbot

2018-08-26 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

test_multiprocessing_spawn fails on x86 Windows7 3.7 buildbot:

https://buildbot.python.org/all/#/builders/111/builds/500

Timeout (0:15:00)!
Thread 0x0c64 (most recent call first):
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\multiprocessing\connection.py",
 line 306 in _recv_bytes
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\multiprocessing\connection.py",
 line 250 in recv
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\multiprocessing\pool.py",
 line 470 in _handle_results
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
865 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
917 in _bootstrap_inner
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
885 in _bootstrap
Thread 0x00b4 (most recent call first):
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\multiprocessing\pool.py",
 line 422 in _handle_tasks
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
865 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
917 in _bootstrap_inner
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
885 in _bootstrap
Thread 0x08d4 (most recent call first):
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\multiprocessing\pool.py",
 line 413 in _handle_workers
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
865 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
917 in _bootstrap_inner
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
885 in _bootstrap
Thread 0x0b88 (most recent call first):
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
296 in wait
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\threading.py", line 
552 in wait
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\multiprocessing\pool.py",
 line 648 in wait
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\multiprocessing\pool.py",
 line 651 in get
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\multiprocessing\pool.py",
 line 261 in apply
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\_test_multiprocessing.py",
 line 2224 in test_apply
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\unittest\case.py", 
line 615 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\unittest\case.py", 
line 663 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\unittest\runner.py",
 line 176 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\support\__init__.py",
 line 1882 in _run_suite
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\support\__init__.py",
 line 1972 in run_unittest
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 175 in test_runner
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 179 in runtest_inner
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 140 in runtest
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 286 in rerun_failed_tests
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 570 in _main
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 531 in main
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 584 in main
  File 
"D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\__main__.py", 
line 2 in 
  File "D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\runpy.py", 
line 85 in _run_code
  File "D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\runpy.py", 
line 193 in _run_module_as_main
Process SpawnPoolWorker-184:
Traceback (most recent 

[issue11193] test_subprocess test_undecodable_env error on AIX

2018-08-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8425

___
Python tracker 

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



Re: Writing a program to illustrate a fractal

2018-08-26 Thread Richard Damon
On 8/26/18 5:40 PM, Dennis Lee Bieber wrote:
>   But their definition is still confusing as it is formulated with a
> expression as the argument to a().
>
>   Taken literally, it says for n+4 to call a() with an argument of 8 (2n)
> AND to call it with an argument of 7 (2n-1) (returning two values) 

I have seen that sort of notation before for defining sequences (which
is what he was doing). Yes, it is not very useful for actually
implementing a function to compute the values, but if a was stored in an
array it makes some sense, as you make a loop that runs n, and compute
the various elements. The one confusion with how it was defined was that
the recursive definition starts at n=2, but for that value you only
compute the even value, as 2*n-1 = 3 which has already been defined, and
that definition would reference a(0) which hasn't been defined.

This is one reason I presented what I say as the 'normalized' equations
which are what would be more needed to actually compute as a function.

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34512] Document platform-specific strftime() behavior for non-ASCII format strings

2018-08-26 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
keywords: +patch
pull_requests: +8424
stage:  -> patch review

___
Python tracker 

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



[issue34512] Document platform-specific strftime() behavior for non-ASCII format strings

2018-08-26 Thread Alexey Izbyshev

New submission from Alexey Izbyshev :

If a format string contains code points outside of ASCII range, time.strftime() 
can behave in four different ways depending on the platform, the current locale 
and the code points:

* raise a UnicodeEncodeError
* return an empty string
* for surrogates in \uDC80-\uDCFF range, replace them with different code 
points in the output (potentially mangling nearby parts of the output as well)
* round-trip them correctly

Some examples:

* Linux (glibc 2.27):
Python 3.6.4 (default, Jan 03 2018, 13:52:55) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import time, locale
>>> locale.getlocale()
('en_US', 'UTF-8')
>>> time.strftime('\x80')
'\x80'
>>> time.strftime('\u044f')
'я' # '\u044f'
>>> time.strftime('\ud800')
'\ud800'
>>> time.strftime('\udcff')
'\udcff'
>>> locale.setlocale(locale.LC_CTYPE, 'C')
'C'
>>> time.strftime('\x80')
'\x80'
>>> time.strftime('\u044f')
'я' # '\u044f'
>>> time.strftime('\ud800')
'\ud800'
>>> time.strftime('\udcff')
'\udcff'

* macOS 10.13.6 and FreeBSD 11.1:
Python 3.7.0 (default, Jul 23 2018, 20:22:55)
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import time, locale
>>> locale.getlocale()
('en_US', 'UTF-8')
>>> time.strftime('\x80')
'\x80'
>>> time.strftime('\u044f')
'я' # '\u044f'
>>> time.strftime('\ud800')
''
>>> time.strftime('\udcff')
''
>>> locale.setlocale(locale.LC_CTYPE, 'C')
'C'
>>> time.strftime('\x80')
'\x80'
>>> time.strftime('\u044f')
''
>>> time.strftime('\ud800')
''
>>> time.strftime('\udcff')
''

* Windows 8.1:
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit 
(AMD64)] on win32
>>> import time, locale
>>> locale.getlocale()
(None, None)
>>> time.strftime('\x80')
'\x80'
>>> time.strftime('\u044f')
Traceback (most recent call last):
  File "", line 1, in 
UnicodeEncodeError: 'locale' codec can't encode character '\u044f' in position 
0: encoding error
>>> time.strftime('\ud800')
Traceback (most recent call last):
  File "", line 1, in 
UnicodeEncodeError: 'locale' codec can't encode character '\ud800' in position 
0: encoding error
>>> time.strftime('\udcff')
'y' # '\xff'
>>> locale.setlocale(locale.LC_CTYPE, '')
'Russian_Russia.1251'
>>> time.strftime('\x80')
Traceback (most recent call last):
  File "", line 1, in 
UnicodeEncodeError: 'locale' codec can't encode character '\x80' in position 0: 
encoding error
>>> time.strftime('\u044f')
'я' # '\u044f'
>>> time.strftime('\ud800')
Traceback (most recent call last):
  File "", line 1, in 
UnicodeEncodeError: 'locale' codec can't encode character '\ud800' in position 
0: encoding error
>>> time.strftime('\udcff')
'я' # '\u044f'

The reasons of such differences are the following:
* Reliance on either wcsftime() or strftime() from the C library depending on 
the platform.
* For strftime(), the input is encoded into the charset of the current locale 
with 'surrogateescape' error handler, and the output is decoded back in the 
same way.
* Different handling of code points which are unrepresentable in the charset of 
the current locale by glibc and macOS/FreeBSD.

I suggest to at least document that the format string, despite being an 'str', 
requires special care if it contains non-ASCII code points.

The 'datetime' module docs warn about the locale-dependent output, but only 
with regard to particular format specifiers [1].

I'll submit a draft PR. Suggestions are welcome.

[1] 
https://docs.python.org/3.7/library/datetime.html#strftime-and-strptime-behavior

--
assignee: docs@python
components: Documentation
messages: 324136
nosy: belopolsky, docs@python, izbyshev, p-ganssle, taleinat
priority: normal
severity: normal
status: open
title: Document platform-specific strftime() behavior for non-ASCII format 
strings
type: enhancement
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue34511] I suggest to add documentation about "method" parameter of urllib.request.Request class

2018-08-26 Thread Mariatta Wijaya


Mariatta Wijaya  added the comment:

method is added in Python 3.3. You're referencing documentation of Python 3.2.

The documentation is correct for later Python versions: 
https://docs.python.org/3.7/library/urllib.request.html#urllib.request.Request

--
nosy: +Mariatta
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue34510] add HTTPConnection.settimeout()

2018-08-26 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
title: Add add HTTPConnection.settimeout() -> add HTTPConnection.settimeout()

___
Python tracker 

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



[issue34511] I suggest to add documentation about "method" parameter of urllib.request.Request class

2018-08-26 Thread harobed

New submission from harobed :

Hi,

I see "method=None" parameter in urllib.request.Request constructor 
(https://github.com/python/cpython/blob/master/Lib/urllib/request.py#L327) but 
I don't see "method" parameter in documentation: 
https://docs.python.org/3.2/library/urllib.request.html#urllib.request.Request

I suggest to add documentation about "method".

Best regards,
Stéphane

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 324134
nosy: docs@python, harobed
priority: normal
severity: normal
status: open
title: I suggest to add documentation about "method" parameter of 
urllib.request.Request class
type: enhancement
versions: Python 3.7

___
Python tracker 

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



Re: Generating a specific list of intsgers

2018-08-26 Thread Richard Damon
On 8/26/18 4:20 PM, Musatov wrote:
> My understanding is this: there are an infinite number of n's that are not 
> multiples of three, and yet will always be divisible by at least one of 22 
> primes for all values of k.
>
> i.e. certain n values make the equation produce only composite numbers for 
> all values of k.

But that isn't enough to make the function computable. While we may be
able to have some short cut rules to tell us that for SOME n, the answer
is 0, unless we can answer that question for ALL n, we can't be sure to
compute the answer. If we could compute an upper limit for k given n,
then we could do the computation, but we need to have some rule to stop,
or there may be some values of n that we will loop forever on.

As has been said, this problem is still in the domain of needing some
math to give us the rule to compute with.

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 3:21:08 PM UTC-5, Musatov wrote:
> On Sunday, August 26, 2018 at 3:07:41 PM UTC-5, Oscar Benjamin wrote:
> > On Sun, 26 Aug 2018 at 20:32, Musatov  wrote:
> > >
> > > On Sunday, August 26, 2018 at 2:14:29 PM UTC-5, Oscar Benjamin wrote:
> > > > > > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote:
> > > > > > > > > >>
> > > > > > > > > >>> I am looking for a program able to output a set of 
> > > > > > > > > >>> integers meeting the
> > > > > > > > > >>> following requirement:
> > > > > > > > > >>>
> > > > > > > > > >>> a(n) is the minimum k > 0 such that n*2^k - 3 is prime, 
> > > > > > > > > >>> or 0 if no such
> > > > > > > > > >>> k exists
> > > > > > > > > >>>
> > > > > > > > > >>> Could anyone get me started? (I am an amateur)
> > > >
> > > > Fair enough. So finding a(n) when a(n)!=0 is straight-forward (simply
> > > > loop through testing k=1,2...) but the issue is determining for any
> > > > given n whether a(n)=0 i.e. that there does not exist k such that
> > > > n*2^k-3 is prime.
> > > >
> > > > Perhaps if you explain how you know that
> > > >a(72726958979572419805016319140106929109473069209) = 0
> > > > then that would suggest a way to code it.
> > > >
> > > Oscar, I simply asked someone and they provided me the number. I know 
> > > they often use Maple, but I was interested in Python.
> > > He also said some of the n are prime by Dirichlet's theorem. One is 
> > > 8236368172492875810638652252525796530412199592269.
> > 
> > If it is possible at all then it is certainly possible to do this in
> > Python but only for someone who knows the necessary maths. The purpose
> > of computers in these kinds of problems is that they are much faster
> > at number-crunching. You still need to know how (at least in
> > principle) you would do this by hand in order to program it in Python
> > or most likely anything else.
> > 
> > I don't think anyone here knows the answer to the mathematical
> > question "how do I prove that a(n)=0 for some n?". If you knew the
> > answer to that question then I'm sure many people could help you write
> > code for it.
> > 
> > Without that I think you need to go back to your mathematician friends
> > or do some more reading.
> > 
> > Are you sure that the problem you have posed here is solvable (i.e.
> > that whether or not a(n)=0 is decidable for any n)?
> > 
> > --
> > Oscar
> 
> My understanding is this: there are an infinite number of n's that are not 
> multiples of three, and yet will always be divisible by at least one of 22 
> primes for all values of k.
> 
> i.e. certain n values make the equation produce only composite numbers for 
> all values of k.

Just to be clear it is not the n I was referring to being composite but the 
result when certain n are fed into the n*2^k - 3
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a program to illustrate a fractal

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 3:13:00 PM UTC-5, Oscar Benjamin wrote:
> On Sun, 26 Aug 2018 at 20:52, Musatov  wrote:
> >
> > Thank you, Richard. If anyone is interested further, even in writing a 
> > Python code to generate the sequence or further preparing of an animation I 
> > would be delighted.
> 
> It would not take long to write code to plot your sequence if you
> first cover the basics of Python. What have you tried so far?
> 
> Have you read the python.org tutorial? Here's a page from there that
> mentions the Fibonacci sequence incidentally:
> https://docs.python.org/3/tutorial/modules.html
> 
> For plotting I suggest matplotlib:
> https://matplotlib.org/users/pyplot_tutorial.html
> 
> --
> Oscar

I have some learning to do, but if I get stuck I'll write back on this thread.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 3:07:41 PM UTC-5, Oscar Benjamin wrote:
> On Sun, 26 Aug 2018 at 20:32, Musatov  wrote:
> >
> > On Sunday, August 26, 2018 at 2:14:29 PM UTC-5, Oscar Benjamin wrote:
> > > > > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote:
> > > > > > > > >>
> > > > > > > > >>> I am looking for a program able to output a set of integers 
> > > > > > > > >>> meeting the
> > > > > > > > >>> following requirement:
> > > > > > > > >>>
> > > > > > > > >>> a(n) is the minimum k > 0 such that n*2^k - 3 is prime, or 
> > > > > > > > >>> 0 if no such
> > > > > > > > >>> k exists
> > > > > > > > >>>
> > > > > > > > >>> Could anyone get me started? (I am an amateur)
> > >
> > > Fair enough. So finding a(n) when a(n)!=0 is straight-forward (simply
> > > loop through testing k=1,2...) but the issue is determining for any
> > > given n whether a(n)=0 i.e. that there does not exist k such that
> > > n*2^k-3 is prime.
> > >
> > > Perhaps if you explain how you know that
> > >a(72726958979572419805016319140106929109473069209) = 0
> > > then that would suggest a way to code it.
> > >
> > Oscar, I simply asked someone and they provided me the number. I know they 
> > often use Maple, but I was interested in Python.
> > He also said some of the n are prime by Dirichlet's theorem. One is 
> > 8236368172492875810638652252525796530412199592269.
> 
> If it is possible at all then it is certainly possible to do this in
> Python but only for someone who knows the necessary maths. The purpose
> of computers in these kinds of problems is that they are much faster
> at number-crunching. You still need to know how (at least in
> principle) you would do this by hand in order to program it in Python
> or most likely anything else.
> 
> I don't think anyone here knows the answer to the mathematical
> question "how do I prove that a(n)=0 for some n?". If you knew the
> answer to that question then I'm sure many people could help you write
> code for it.
> 
> Without that I think you need to go back to your mathematician friends
> or do some more reading.
> 
> Are you sure that the problem you have posed here is solvable (i.e.
> that whether or not a(n)=0 is decidable for any n)?
> 
> --
> Oscar

My understanding is this: there are an infinite number of n's that are not 
multiples of three, and yet will always be divisible by at least one of 22 
primes for all values of k.

i.e. certain n values make the equation produce only composite numbers for all 
values of k.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a program to illustrate a fractal

2018-08-26 Thread Oscar Benjamin
On Sun, 26 Aug 2018 at 20:52, Musatov  wrote:
>
> Thank you, Richard. If anyone is interested further, even in writing a Python 
> code to generate the sequence or further preparing of an animation I would be 
> delighted.

It would not take long to write code to plot your sequence if you
first cover the basics of Python. What have you tried so far?

Have you read the python.org tutorial? Here's a page from there that
mentions the Fibonacci sequence incidentally:
https://docs.python.org/3/tutorial/modules.html

For plotting I suggest matplotlib:
https://matplotlib.org/users/pyplot_tutorial.html

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Oscar Benjamin
On Sun, 26 Aug 2018 at 20:32, Musatov  wrote:
>
> On Sunday, August 26, 2018 at 2:14:29 PM UTC-5, Oscar Benjamin wrote:
> > > > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote:
> > > > > > > >>
> > > > > > > >>> I am looking for a program able to output a set of integers 
> > > > > > > >>> meeting the
> > > > > > > >>> following requirement:
> > > > > > > >>>
> > > > > > > >>> a(n) is the minimum k > 0 such that n*2^k - 3 is prime, or 0 
> > > > > > > >>> if no such
> > > > > > > >>> k exists
> > > > > > > >>>
> > > > > > > >>> Could anyone get me started? (I am an amateur)
> >
> > Fair enough. So finding a(n) when a(n)!=0 is straight-forward (simply
> > loop through testing k=1,2...) but the issue is determining for any
> > given n whether a(n)=0 i.e. that there does not exist k such that
> > n*2^k-3 is prime.
> >
> > Perhaps if you explain how you know that
> >a(72726958979572419805016319140106929109473069209) = 0
> > then that would suggest a way to code it.
> >
> Oscar, I simply asked someone and they provided me the number. I know they 
> often use Maple, but I was interested in Python.
> He also said some of the n are prime by Dirichlet's theorem. One is 
> 8236368172492875810638652252525796530412199592269.

If it is possible at all then it is certainly possible to do this in
Python but only for someone who knows the necessary maths. The purpose
of computers in these kinds of problems is that they are much faster
at number-crunching. You still need to know how (at least in
principle) you would do this by hand in order to program it in Python
or most likely anything else.

I don't think anyone here knows the answer to the mathematical
question "how do I prove that a(n)=0 for some n?". If you knew the
answer to that question then I'm sure many people could help you write
code for it.

Without that I think you need to go back to your mathematician friends
or do some more reading.

Are you sure that the problem you have posed here is solvable (i.e.
that whether or not a(n)=0 is decidable for any n)?

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34510] Add add HTTPConnection.settimeout()

2018-08-26 Thread Collin Anderson


Change by Collin Anderson :


--
components: Library (Lib)
nosy: collinanderson
priority: normal
pull_requests: 8422
severity: normal
status: open
title: Add add HTTPConnection.settimeout()
type: enhancement

___
Python tracker 

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



Re: Writing a program to illustrate a fractal

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 2:35:13 PM UTC-5, Richard Damon wrote:
> On 8/26/18 1:58 PM, Musatov wrote:
> > On Sunday, August 26, 2018 at 12:49:16 PM UTC-5, Richard Damon wrote:
> >> On 8/26/18 12:48 PM, Dennis Lee Bieber wrote:
>  The sequence is defined by:
> 
>  For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = 
>  a(n) + a(n-2).
> 
> >>> I am not sure what 'fractal' property this sequence has that he
> >>> wants to 
> >> display.
> > I'm sorry, let me try to explain:
> >
> > Here is my output:
> > 1, 2, 3, 5, 4, 8, 7, 9, 7, 12, 13, 15, 11, 16, 17, 16, 14, 19, 21, 25, 20, 
> > 28, 27, 26, 24, 27, 31, 33, 28, 33, 32, 30, 31, 33, 35, 40, 35, 46, 44, 45, 
> > 41, 48, 53, 55, 47, 53, 54, 50, 51, 51, 53,
> >
> > It is an OEIS sequence. 
> >
> > I was told this image of the scatterplot emphasizes the 'fractal nature' of 
> > my sequence:
> >
> > https://oeis.org/A292575/a292575.png
> 
> Something is wrong with that image compared to the sequence, as the
> sequence is always positive, and in fact the lowest the sequence can get
> to is always increasing (as it starts always positive, and each term is
> the sum of two previous terms),while the graph is going negative.
> 
> (actually going to the definition of the sequence, the plot isn't of
> a(n) but a(n)-n, which can go negative)
> 
> I normally think for fractals as a sequence of patterns of increasing
> complexity, or a pattern looked at with increasing resolution revealing
> the growth pattern. This sequence isn't quite like that, but I suppose
> if you think of the sequence a(n) in the interval m <= n <= 2*m, and
> then the interval 2*m <= n <= 4*m, that second interval is somewhat like
> the first with some recursively added pattern (especially if you include
> the -n in the sequence).
> 
> That graph is probably the best way to show that pattern.
> 
> One thing that might help, is to clean up the definition of a(n) to be
> more directly computable, and  maybe even include the subtraction of n.
> 
> A rewriting of your rules would be:
> 
> a(n)
> 
> n=1,2,3:    a(n) = n
> 
> n>3, and even: a(n) = a(n/2) + a(n/2+1)
> 
> n>3 and odd: a(n) = a((n+1)/2) + a(n-3)/2)
> 
> If I have done my math right, this is the same sequence definition, but
> always defining what a(n) is equal to.
> 
> If we want to define the sequence b(n) = a(n) - n, we can transform the
> above by substitution
> 
> b(n)
> 
> n=1,2,3: b(n) = 0
> 
> n>3 and even: b(n) = a(n/2)+a(n/2+1)-n
> 
>     = b(n/2)+b(n/2+1) + n/2 + n/2+1 -n
> 
>     = b(n/2) + b(n/2+1) + 1
> 
> n>3 and odd: b(n) = a((n+1)/2) + a((n-3)/2) - n
> 
>     = b((n+1)/2) + b((n-3)/2) + (n+1)/2 + (n-3)/2 -n
> 
>     = b((n+1)/2) + b((n-3)/2) -1
> 
> -- 
> Richard Damon

Thank you, Richard. If anyone is interested further, even in writing a Python 
code to generate the sequence or further preparing of an animation I would be 
delighted.

Musatov
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Writing a program to illustrate a fractal

2018-08-26 Thread Richard Damon
On 8/26/18 1:58 PM, Musatov wrote:
> On Sunday, August 26, 2018 at 12:49:16 PM UTC-5, Richard Damon wrote:
>> On 8/26/18 12:48 PM, Dennis Lee Bieber wrote:
 The sequence is defined by:

 For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = 
 a(n) + a(n-2).

>>> I am not sure what 'fractal' property this sequence has that he
>>> wants to 
>> display.
> I'm sorry, let me try to explain:
>
> Here is my output:
> 1, 2, 3, 5, 4, 8, 7, 9, 7, 12, 13, 15, 11, 16, 17, 16, 14, 19, 21, 25, 20, 
> 28, 27, 26, 24, 27, 31, 33, 28, 33, 32, 30, 31, 33, 35, 40, 35, 46, 44, 45, 
> 41, 48, 53, 55, 47, 53, 54, 50, 51, 51, 53,
>
> It is an OEIS sequence. 
>
> I was told this image of the scatterplot emphasizes the 'fractal nature' of 
> my sequence:
>
> https://oeis.org/A292575/a292575.png

Something is wrong with that image compared to the sequence, as the
sequence is always positive, and in fact the lowest the sequence can get
to is always increasing (as it starts always positive, and each term is
the sum of two previous terms),while the graph is going negative.

(actually going to the definition of the sequence, the plot isn't of
a(n) but a(n)-n, which can go negative)

I normally think for fractals as a sequence of patterns of increasing
complexity, or a pattern looked at with increasing resolution revealing
the growth pattern. This sequence isn't quite like that, but I suppose
if you think of the sequence a(n) in the interval m <= n <= 2*m, and
then the interval 2*m <= n <= 4*m, that second interval is somewhat like
the first with some recursively added pattern (especially if you include
the -n in the sequence).

That graph is probably the best way to show that pattern.

One thing that might help, is to clean up the definition of a(n) to be
more directly computable, and  maybe even include the subtraction of n.

A rewriting of your rules would be:

a(n)

n=1,2,3:    a(n) = n

n>3, and even: a(n) = a(n/2) + a(n/2+1)

n>3 and odd: a(n) = a((n+1)/2) + a(n-3)/2)

If I have done my math right, this is the same sequence definition, but
always defining what a(n) is equal to.

If we want to define the sequence b(n) = a(n) - n, we can transform the
above by substitution

b(n)

n=1,2,3: b(n) = 0

n>3 and even: b(n) = a(n/2)+a(n/2+1)-n

    = b(n/2)+b(n/2+1) + n/2 + n/2+1 -n

    = b(n/2) + b(n/2+1) + 1

n>3 and odd: b(n) = a((n+1)/2) + a((n-3)/2) - n

    = b((n+1)/2) + b((n-3)/2) + (n+1)/2 + (n-3)/2 -n

    = b((n+1)/2) + b((n-3)/2) -1

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 2:14:29 PM UTC-5, Oscar Benjamin wrote:
> On Sat, 25 Aug 2018 at 20:27, Musatov  wrote:
> >
> > On Saturday, August 25, 2018 at 2:18:09 PM UTC-5, Musatov wrote:
> > > On Saturday, August 25, 2018 at 1:52:17 PM UTC-5, Oscar Benjamin wrote:
> > > > > > >
> > > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote:
> > > > > > >>
> > > > > > >>> I am looking for a program able to output a set of integers 
> > > > > > >>> meeting the
> > > > > > >>> following requirement:
> > > > > > >>>
> > > > > > >>> a(n) is the minimum k > 0 such that n*2^k - 3 is prime, or 0 if 
> > > > > > >>> no such
> > > > > > >>> k exists
> > > > > > >>>
> > > > > > >>> Could anyone get me started? (I am an amateur)
> > > > > > >>
> > > > > > >> That's more a maths question than a programming question. Find 
> > > > > > >> out how to
> > > > > > >> tackle it mathematically, and then we can code it.
> > > >
> > > > Looks like it's zero for any multiple of 3 (apart from 3 itself). This
> > > > makes sense since if n is a equal to b*3 for some integer b then
> > > > n*2^k - 3 = b*3*2^k - 3 = (b*2^k - 1)*3
> > > > which can only be prime if
> > > > b*2^k - 1 = 1
> > > > which can only be true if b=1 (since k>0) implying that n=3. So for
> > > > any *other* multiple of 3 you must necessarily have a(n) = 0.
> > > >
> > > > The above means that you can handle all multiples of 3 but how do you
> > > > know that you won't hit an infinite loop when n is not a multiple of
> > > > 3?
> >
> > Rather, I should say one such n is 
> > 72726958979572419805016319140106929109473069209 (which is not divisible by 
> > 3)
> 
> Fair enough. So finding a(n) when a(n)!=0 is straight-forward (simply
> loop through testing k=1,2...) but the issue is determining for any
> given n whether a(n)=0 i.e. that there does not exist k such that
> n*2^k-3 is prime.
> 
> Perhaps if you explain how you know that
>a(72726958979572419805016319140106929109473069209) = 0
> then that would suggest a way to code it.
> 
> --
> Oscar
Oscar, I simply asked someone and they provided me the number. I know they 
often use Maple, but I was interested in Python.

He also said some of the n are prime by Dirichlet's theorem. One is 
8236368172492875810638652252525796530412199592269.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Generating a specific list of intsgers

2018-08-26 Thread Oscar Benjamin
On Sat, 25 Aug 2018 at 20:27, Musatov  wrote:
>
> On Saturday, August 25, 2018 at 2:18:09 PM UTC-5, Musatov wrote:
> > On Saturday, August 25, 2018 at 1:52:17 PM UTC-5, Oscar Benjamin wrote:
> > > > > >
> > > > > >> On Fri, 24 Aug 2018 14:40:00 -0700, tomusatov wrote:
> > > > > >>
> > > > > >>> I am looking for a program able to output a set of integers 
> > > > > >>> meeting the
> > > > > >>> following requirement:
> > > > > >>>
> > > > > >>> a(n) is the minimum k > 0 such that n*2^k - 3 is prime, or 0 if 
> > > > > >>> no such
> > > > > >>> k exists
> > > > > >>>
> > > > > >>> Could anyone get me started? (I am an amateur)
> > > > > >>
> > > > > >> That's more a maths question than a programming question. Find out 
> > > > > >> how to
> > > > > >> tackle it mathematically, and then we can code it.
> > >
> > > Looks like it's zero for any multiple of 3 (apart from 3 itself). This
> > > makes sense since if n is a equal to b*3 for some integer b then
> > > n*2^k - 3 = b*3*2^k - 3 = (b*2^k - 1)*3
> > > which can only be prime if
> > > b*2^k - 1 = 1
> > > which can only be true if b=1 (since k>0) implying that n=3. So for
> > > any *other* multiple of 3 you must necessarily have a(n) = 0.
> > >
> > > The above means that you can handle all multiples of 3 but how do you
> > > know that you won't hit an infinite loop when n is not a multiple of
> > > 3?
>
> Rather, I should say one such n is 
> 72726958979572419805016319140106929109473069209 (which is not divisible by 3)

Fair enough. So finding a(n) when a(n)!=0 is straight-forward (simply
loop through testing k=1,2...) but the issue is determining for any
given n whether a(n)=0 i.e. that there does not exist k such that
n*2^k-3 is prime.

Perhaps if you explain how you know that
   a(72726958979572419805016319140106929109473069209) = 0
then that would suggest a way to code it.

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34497] Remove needless set operator restriction

2018-08-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Sorry Dan, we're going to pass on this one.  The current behavior was an 
intentional design choice by Guido and reflects a careful balance between some 
difficult trade-offs.

An early and permanent mistake in Python's design is that list.__iadd__() and 
list.extend() both accept any input iterable.  For extend(), this proved to be 
useful.  In contrast, __iadd__() was a recurring bug magnet.  People would 
routinely type "s=['abc']; s+='def'" expecting to get ['abc', 'def'] rather 
than ['abc', 'd', 'e', 'f'].   Based on this experience, Guido wisely opined 
that math operators on other concrete collection classes should be restricted 
working with members of their own class.

When abstract base classes were introduced, a seemingly inconsistent decision 
was made.  The Set ABCs allowed the math operators to accept any input iterable 
and did not provide the spelled-out method names (union, intersection, 
difference, etc).

IIRC, there were several reasons for this.  It kept the total number of methods 
to a manageable size (important so as to not unduly burden implementers of 
concrete classes).  Also, having a same type restriction is at odds with some 
of the design goals and use cases for collections ABCs.  Additionally, the code 
for the mixin methods is simpler without the restrictions.

When dict views were implemented, they followed the Set ABCs.  This gave them 
fewer methods than sets but also gave them fewer restrictions.  For the most 
part, these design trade-offs have worked out well in practice.  The existing 
behavior is neither "needless" nor "arbitrary".  It was the result of careful 
consideration by GvR on what works best for most people, most of the time.

--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



Re: Writing a program to illustrate a fractal

2018-08-26 Thread Musatov
On Sunday, August 26, 2018 at 12:49:16 PM UTC-5, Richard Damon wrote:
> On 8/26/18 12:48 PM, Dennis Lee Bieber wrote:
> >> The sequence is defined by:
> >>
> >> For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = 
> >> a(n) + a(n-2).
> >>
> > Confusing explanation -- do you really mean that for n>=4 you are
> > returning TWO values? 

For a(4)..a(19) we have that: 2+3=5, 1+3=4, 3+5=8, 2+5=7, 5+4=9, 3+4=7, 4+8=12, 
5+8=13, 8+7=15, 4+7=11, 7+9=16, 8+9=17, 9+7=16, 7+7=14, 7+12=19, 9+12=21.

If so, it is not a strict function. I'd also write it
> > as
> 
> I think they intend that a(n) is defined for n being an integer (or
> maybe just the Natural Numbers, since it isn't defined for values below 1)
> 
> The two provided definitions provide the recursive definition for even
> and odd values.
> 
> I am not sure what 'fractal' property this sequence has that he wants to
> display.

I'm sorry, let me try to explain:

Here is my output:
1, 2, 3, 5, 4, 8, 7, 9, 7, 12, 13, 15, 11, 16, 17, 16, 14, 19, 21, 25, 20, 28, 
27, 26, 24, 27, 31, 33, 28, 33, 32, 30, 31, 33, 35, 40, 35, 46, 44, 45, 41, 48, 
53, 55, 47, 53, 54, 50, 51, 51, 53,

It is an OEIS sequence. 

I was told this image of the scatterplot emphasizes the 'fractal nature' of my 
sequence:

https://oeis.org/A292575/a292575.png
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34509] Starting to use gcc-8 on CI

2018-08-26 Thread Jun Aruga


Jun Aruga  added the comment:

> it would be better to set up a buildbot running GCC 8, or switching one of 
> our existing workers to it.  We want to keep the pre-merge CI as stable as 
> possible, and using a bleeding-edge compiler doesn't strike me as 
> particularly stable.

Oh it seems that we have already had the CI environment as buildbot. I did not 
know that. Yeah it might be better to add it as a buildbot.

https://buildbot.python.org/all/#/

--

___
Python tracker 

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



Re: Writing a program to illustrate a fractal

2018-08-26 Thread Richard Damon
On 8/26/18 12:48 PM, Dennis Lee Bieber wrote:
>> The sequence is defined by:
>>
>> For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = a(n) 
>> + a(n-2).
>>
>   Confusing explanation -- do you really mean that for n>=4 you are
> returning TWO values? If so, it is not a strict function. I'd also write it
> as

I think they intend that a(n) is defined for n being an integer (or
maybe just the Natural Numbers, since it isn't defined for values below 1)

The two provided definitions provide the recursive definition for even
and odd values.

I am not sure what 'fractal' property this sequence has that he wants to
display.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34509] Starting to use gcc-8 on CI

2018-08-26 Thread Zachary Ware


Zachary Ware  added the comment:

I think rather than switching Travis CI (or VSTS) to GCC 8, it would be better 
to set up a buildbot running GCC 8, or switching one of our existing workers to 
it.  We want to keep the pre-merge CI as stable as possible, and using a 
bleeding-edge compiler doesn't strike me as particularly stable.

--
nosy: +zach.ware

___
Python tracker 

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



[issue11193] test_subprocess test_undecodable_env error on AIX

2018-08-26 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

https://github.com/python/cpython/pull/8939 and 
https://github.com/python/cpython/pull/8946

--

___
Python tracker 

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



[issue11193] test_subprocess test_undecodable_env error on AIX

2018-08-26 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
resolution:  -> fixed

___
Python tracker 

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



[issue11193] test_subprocess test_undecodable_env error on AIX

2018-08-26 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

someone with modern AIX access reopen if this specific issue still appears to 
exist after the 3.8 and 3.7 PRs finish merging.

--
nosy: +gregory.p.smith
stage: patch review -> resolved
status: open -> closed
title: test_subprocess error on AIX -> test_subprocess test_undecodable_env 
error on AIX
versions: +Python 3.7

___
Python tracker 

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



[issue34497] Remove needless set operator restriction

2018-08-26 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue34494] simple "sequence" class ignoring __len__

2018-08-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur with Josh.  This matches the documented behavior and isn't a bug. 
Marking as closed.

There are potentially two ways to stop sequence iteration, either by using len 
or by waiting for IndexError.  Python uses the latter to allow lists to be 
dynamically resized during iteration and because checking len on every 
iteration would be expensive.  

If someone doesn't read the docs, and assumes Python uses len, and writes an 
inconsistent class (one where len doesn't match the point where IndexError is 
raised), then there is little we can do to prevent that person from being 
"surprised".

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue34503] Reference leak in PyErr_SetObject()

2018-08-26 Thread Xiang Zhang


Change by Xiang Zhang :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue34509] Starting to use gcc-8 on CI

2018-08-26 Thread Jun Aruga


Change by Jun Aruga :


--
keywords: +patch
pull_requests: +8418
stage:  -> patch review

___
Python tracker 

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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-26 Thread Zachary Ware


Zachary Ware  added the comment:

> Can we manually ssh into the buildbots from the buildbot master and delete 
> the file?

No, there is no access to the workers except for the connection created by each 
worker for the purpose of buildbot communication (and individually by each 
worker owner).

> It may be easier to remove "trace.cover" before testing every time than clean 
> up all buildbots once.

I agree.  Alternately, the test could be changed to avoid that assertion; it's 
strange that the test could fail just because a file could happen to exist 
outside of the test's control.

--

___
Python tracker 

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



[issue34509] Starting to use gcc-8 on CI

2018-08-26 Thread Jun Aruga


New submission from Jun Aruga :

This ticket is from below conversation on python-dev mailing list.
https://mail.python.org/pipermail/python-dev/2018-August/155011.html

Right now the Python project Travis CI is running on gcc-4.8.4 for coverage 
testing.
I want to replace it or add the latest version gcc-8 case.

The benefit to use gcc-8 is,

* It is important to run on the old version 4.8 but, it is also meaningful to 
follow the latest version and care issues such as warnings on the latest 
version gcc.
* I am working in Fedora project that is using gcc version 8 as a main c 
compiler. If the Python project care gcc-8, that might be helpful for people 
who maintain Python Debian/Fedora package or Installer on Mac/Windows.


The demerit is

* Right now the gcc-4.8 is used for the coverage. The total running time on 
gcc-8 might be longer than current one.
* To run the latest gcc-8, we can add the repository [1] with the way [2][3], 
but I am not sure whether the repository is stable.

I would show you 2 cases to use gcc-8 on Linux.

[1] https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
[2] 
https://docs.travis-ci.com/user/installing-dependencies/#installing-packages-from-a-custom-apt-repository
[3] https://docs.travis-ci.com/user/languages/c/#gcc-on-os-x
[4] Ruby
   https://travis-ci.org/junaruga/ruby/builds/418242410
   https://github.com/junaruga/ruby/blob/feature/ci-new-gcc/.travis.yml
   https://github.com/ruby/ruby/pull/1937
[5] Trinity
   Example for gcc-8 on both Linux and Mac.
   https://travis-ci.org/trinityrnaseq/trinityrnaseq
   https://github.com/trinityrnaseq/trinityrnaseq/blob/master/.travis.yml

--
messages: 324125
nosy: junaruga
priority: normal
severity: normal
status: open
title: Starting to use gcc-8 on CI
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue34503] Reference leak in PyErr_SetObject()

2018-08-26 Thread miss-islington


miss-islington  added the comment:


New changeset 204fb459ca1d77c2eab02a3191ba2d2216ff2d72 by Miss Islington (bot) 
in branch '3.6':
bpo-34503: Fix refleak in PyErr_SetObject() (GH-8934)
https://github.com/python/cpython/commit/204fb459ca1d77c2eab02a3191ba2d2216ff2d72


--
nosy: +miss-islington

___
Python tracker 

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



[issue34503] Reference leak in PyErr_SetObject()

2018-08-26 Thread miss-islington


miss-islington  added the comment:


New changeset 2caf86ff6d72d625f86db78c6e90fdaf09e8f703 by Miss Islington (bot) 
in branch '3.7':
bpo-34503: Fix refleak in PyErr_SetObject() (GH-8934)
https://github.com/python/cpython/commit/2caf86ff6d72d625f86db78c6e90fdaf09e8f703


--

___
Python tracker 

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



[issue34503] Reference leak in PyErr_SetObject()

2018-08-26 Thread Xiang Zhang


Xiang Zhang  added the comment:


New changeset a2eefa67542c25617a58c03a27c17fd48e2a0856 by Xiang Zhang (Alexey 
Izbyshev) in branch 'master':
bpo-34503: Fix refleak in PyErr_SetObject() (GH-8934)
https://github.com/python/cpython/commit/a2eefa67542c25617a58c03a27c17fd48e2a0856


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue34503] Reference leak in PyErr_SetObject()

2018-08-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8417

___
Python tracker 

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



[issue34503] Reference leak in PyErr_SetObject()

2018-08-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8416

___
Python tracker 

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



[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-26 Thread Mark Dickinson


Change by Mark Dickinson :


--
pull_requests: +8415

___
Python tracker 

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



Writing a program to illustrate a fractal

2018-08-26 Thread Musatov
I have an integer sequence of a fractal nature and want to know if it is 
possible to write a program to illustrate it in a manner similar to the many 
animated Mandelbrot illustrations.

The sequence is defined by:

For 1 <= n <= 3, a(n) = n; thereafter, a(2n) = a(n) + a(n+1), a(2n-1) = a(n) + 
a(n-2).

Output begins:
1, 2, 3, 5, 4, 8, 7, 9, 7, 12, 13, 15, 11, 16, 17, 16, 14, 19, 21, 25, 20, 28, 
27, 26, 24, 27, 31, 33...

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-26 Thread Mark Dickinson


Change by Mark Dickinson :


--
keywords: +patch
pull_requests: +8414
stage:  -> patch review

___
Python tracker 

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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It may be easier to remove "trace.cover" before testing every time than clean 
up all buildbots once.

--

___
Python tracker 

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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +8413
stage: resolved -> patch review

___
Python tracker 

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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-26 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Can we manually ssh into the buildbots from the buildbot master and delete the 
file?

--

___
Python tracker 

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



[issue34494] simple "sequence" class ignoring __len__

2018-08-26 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

That's the documented behavior. Per 
https://docs.python.org/3/reference/datamodel.html#object.__getitem__ :

>Note: for loops expect that an IndexError will be raised for illegal indexes 
>to allow proper detection of the end of the sequence. 

The need for *only* __getitem__ is also mentioned in the documentation of the 
iter builtin ( https://docs.python.org/3/library/functions.html#iter ):

>Without a second argument, object must be a collection object which supports 
>the iteration protocol (the __iter__() method), or it must support the 
>sequence protocol (the __getitem__() method with integer arguments starting at 
>0).

At no point is a dependency on __len__ mentioned.

--
nosy: +josh.r

___
Python tracker 

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



[issue34508] return of non-parenthesized star-unpacking expression a SyntaxError

2018-08-26 Thread Mark Dickinson


New submission from Mark Dickinson :

[From https://stackoverflow.com/q/52026406/270986]

The following is valid, and works as expected:

>>> def f():
... x = *(1, 2), 3
... return x
... 
>>> f()
(1, 2, 3)

But the tuple expression can't be used directly in a "return" statement:

>>> def f():
... return *(1, 2), 3
  File "", line 2
return *(1, 2), 3
   ^
SyntaxError: invalid syntax

It's trivial to work around, by adding an extra pair of parentheses around the 
return target, but it seems a surprising inconsistency. Would it make sense to 
allow this? In terms of the grammar,

return_stmt: 'return' [testlist]

would be replaced with:

return_stmt: 'return' [testlist_star_expr]

There may be other places in the grammar where "testlist" could reasonably be 
replaced with "testlist_star_expr", for example:

for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]

--
components: Interpreter Core
messages: 324118
nosy: mark.dickinson
priority: normal
severity: normal
status: open
title: return of non-parenthesized star-unpacking expression a SyntaxError
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue11193] test_subprocess error on AIX

2018-08-26 Thread Michael Felt


Change by Michael Felt :


--
keywords: +patch
pull_requests: +8412
stage:  -> patch review

___
Python tracker 

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



[issue11193] test_subprocess error on AIX

2018-08-26 Thread Michael Felt


Michael Felt  added the comment:

Short Version:
root@x065:[/data/prj/python/python3-3.8]./python -m test test_subprocess
Run tests sequentially
0:00:00 [1/1] test_subprocess
test_subprocess passed in 2 min 18 sec

== Tests result: SUCCESS ==

1 test OK.

Total duration: 2 min 18 sec
Tests result: SUCCESS

...
--
Ran 285 tests in 136.443s

OK (skipped=33)
test_subprocess passed in 2 min 16 sec

== Tests result: SUCCESS ==

1 test OK.

Total duration: 2 min 16 sec
Tests result: SUCCESS

Posting a PR - tested manually on AIX 5.3, AIX 6.1 and AIX 7.1

imho: being able to remove the special condition for AIX is an improvement.

diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 73b57b21db..4719773b67 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -2228,15 +2228,9 @@ class POSIXProcessTestCase(BaseTestCase):
 env = os.environ.copy()
 env[key] = value
 # Use C locale to get ASCII for the locale encoding to force
-# surrogate-escaping of \xFF in the child process; otherwise it can
-# be decoded as-is if the default locale is latin-1.
+# surrogate-escaping of \xFF in the child process
 env['LC_ALL'] = 'C'
-if sys.platform.startswith("aix"):
-# On AIX, the C locale uses the Latin1 encoding
-decoded_value = encoded_value.decode("latin1", 
"surrogateescape")
-else:
-# On other UNIXes, the C locale uses the ASCII encoding
-decoded_value = value
+decoded_value = value
 stdout = subprocess.check_output(
 [sys.executable, "-c", script],
 env=env)

--
versions: +Python 3.8 -Python 3.2

___
Python tracker 

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



[issue34507] Add path expansion interpolation in pyvenv.cfg home key

2018-08-26 Thread Lior Cohen


New submission from Lior Cohen :

When working with venv virtual environment, python.exe finds its base_prefix 
and base_exec_prefix by the home key in the pyvenv.cfg file.

If one edits this file with $xyz (or %xyz% in windows), it is not not resolved.

The reason of replacing the absolute path generated by venv to path expand 
tokens, is to be able to port the venv + its base python to different machine, 
which is part of my company deployment process.

--
components: Interpreter Core
messages: 324116
nosy: chnlior
priority: normal
severity: normal
status: open
title: Add path expansion interpolation in pyvenv.cfg home key
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue6700] inspect.getsource() returns incorrect source lines at the module level

2018-08-26 Thread Tal Einat


Tal Einat  added the comment:

Thanks for reporting this, Gabriel!

Thanks for the PR, Vladimir!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue6700] inspect.getsource() returns incorrect source lines at the module level

2018-08-26 Thread Tal Einat


Tal Einat  added the comment:


New changeset 491740f116755e220135e596ec802ea3a0f65596 by Tal Einat in branch 
'2.7':
[2.7] bpo-6700: Fix inspect.getsourcelines for module level frames/tracebacks 
(GH-8864)
https://github.com/python/cpython/commit/491740f116755e220135e596ec802ea3a0f65596


--

___
Python tracker 

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



[issue34506] Traceback logged when SSL handshake fails

2018-08-26 Thread Hrvoje Nikšić

New submission from Hrvoje Nikšić :

When an SSL handshake fails in asyncio, an exception traceback is logged to 
standard error even if the application code catches the exception. This logging 
cannot be suppressed, except by providing a custom exception handler for the 
whole event loop. The question was raised on StackOverflow in 
https://stackoverflow.com/q/52012488/1600898

To reproduce the issue, run the attached minimal example (taken from the SO 
question). Expected behavior is for "Error handled" to be printed. Actual 
behavior is that, in addition to that line, two tracebacks are printed.

It looks like a bug that _fatal_error both logs the exception and calls 
connection_lost on the protocol (through transport._force_close()). If the idea 
is for the exception not to get swallowed by protocols that don't implement a 
sensible connection_lost (e.g. because they've just inherited from 
BaseProtocol, like the echo server examples), then maybe a protocol that 
propagates the exception in connection_lost should be able to opt out of the 
additional logging. That way the stream protocols would avoid spurious output 
for the suppressed exception by default, and the same opt-out mechanism would 
be available to user-written protocols.

--
files: sslerr.py
messages: 324113
nosy: hniksic
priority: normal
severity: normal
status: open
title: Traceback logged when SSL handshake fails
Added file: https://bugs.python.org/file47763/sslerr.py

___
Python tracker 

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



[issue29750] smtplib doesn't handle unicode passwords

2018-08-26 Thread Windson Yang


Change by Windson Yang :


--
keywords: +patch
pull_requests: +8411
stage: needs patch -> patch review

___
Python tracker 

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



[issue33741] UnicodeEncodeError onsmtplib.login(MAIL_USER, MAIL_PASSWORD)

2018-08-26 Thread Windson Yang


Change by Windson Yang :


--
pull_requests: +8410

___
Python tracker 

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



[issue34171] Lib/trace.cover not removed by the clean target

2018-08-26 Thread Zachary Ware


Zachary Ware  added the comment:

It looks like https://github.com/python/buildmaster-config/pull/43 won't 
actually help; I changed it to use `method='clean'` because we don't want to 
blow away the `externals` directory on Windows buildbots, and `*.cover` is in 
`.gitignore` so `Lib/trace.cover` will not be removed.

--

___
Python tracker 

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