Re: Should nested classes in an Enum be Enum members?

2018-06-28 Thread Steven D'Aprano
On Thu, 28 Jun 2018 18:33:31 -0700, Ethan Furman wrote:

> On 06/28/2018 05:58 PM, Ben Finney wrote:
> 
>> So I remain dumbfounded as to why anyone would want a class to *both*
>> be an enumerated type, *and* have callable attributes in its API.
> 
> Perhaps I am using Enum incorrectly, but here is my FederalHoliday Enum.
>  Note that date(), next_business_day, and year() are all callables.  The
> AutoEnum parent assigns values from 1 to n for each member.  It's at
> Stackoverflow [1] if you'd like up- or down-vote it.  ;)

It isn't clear to me why FederalHoliday is an Enum, especially as the API 
seems extremely baraque. 


> class FederalHoliday(AutoEnum):
>  NewYear = "First day of the year.", 'absolute', Month.JANUARY, 1
>  MartinLutherKingJr = "Birth of Civil Rights leader.", \
>  'relative', Month.JANUARY, Weekday.MONDAY, 3 
...


I think I get the idea... the first field is a description, the second 
tells us what month the holiday is in (hope you don't have to deal with 
movable holidays which can change months...). I'm not quite sure what the 
"absolute/relative" flags are (or why they are strings instead of enums). 
Possibly they determine whether the next field is treated as an ordinal 
(first, second, third...) or numerical (1, 2, 3...) value. 

But what isn't clear to me is why these holidays are *enums*. They're 
obviously date instances, with a rich API (at least three methods) and an 
extremely complex constructor (one with variable numbers of arguments).

What makes them enums? Under what circumstances would you be comparing 
something to MartinLutherKingJr (Day) without caring about a *specific* 
Martin Luther King Jr Day?




-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-28 Thread Marko Rauhamaa
Dan Stromberg :
> [on how SO_REUSEADDR is a security risk]

> Start an echo server process P that listens on tcp/.
>
> Initiate a connection from a client machine to process P at tcp/. It
> works as expected.
>
> Kill P.
>
> Initiate a connection from a client machine to process P at tcp/.  It
> gives a connection refused as expected.
>
> If someone else comes along soon after and starts a different echo server
> process Q at tcp/ on the same server, it starts up immediately if P
> used SO_REUSEADDR.
>
> Then initiate a connection from the same (or different) client machine to
> process P (which no longer exists).  Q gets the data intended for P.

Well, the same security issue can be demonstrated without SO_REUSEADDR:

   DON'T start an echo server process P that listens on tcp/.

   Initiate a connection from a client machine to process P at tcp/.  It
   gives a connection refused as expected.

   If someone else comes along and starts an echo server process Q at
   tcp/ on the same server, it starts up immediately.

   Then initiate a connection from the same (or different) client machine to
   process P (which never existed).  Q gets the data intended for P.


The security issue can be real but is not directly related with
SO_REUSEADDR.


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


[issue14117] Turtledemo: exception and minor glitches.

2018-06-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
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



[issue33995] test_min_max_version in test_ssl.py fails when Python is built against LibreSSL; {min,max}imum_version behavior differs from OpenSSL

2018-06-28 Thread Alan Huang


New submission from Alan Huang :

LibreSSL's implementation of the function used to get the minimum and maximum 
SSL versions supported differs from OpenSSL's.

In short, the issue is in the implementations of `SSL_CTX_new` - OpenSSL 
initializes variables `ret->{min,max}_proto_version` to 0, while LibreSSL 
initializes corresponding variables to those of the `SSL_METHOD` given.

As such, when Python is built with LibreSSL, the default values for an instance 
of ssl.SSLContext are, in the case of ssl.SSLContext(), ctx.minimum_version = 
; ctx.maximum_version = .
This is NOT what test_ssl.py expects; it expects OpenSSL's behavior of 
initializing the version variables to zero, which _ssl.c then translates to 
PY_PROTO_{MIN,MAX}IMUM_SUPPORTED -> ssl.TLSVersion.{MIN,MAX}IMUM_SUPPORTED.

Additionally, LibreSSL, when `SSL_CTX_set_{min,max}_proto_version` is called 
with `version` equal to zero, explicitly sets the minimum / maximum values 
equal to the minimum / maximum values for the `SSL_METHOD` it was called with 
(namely, 769/770/771, in the case of `TLS_method()`), not the minimum / maximum 
values supported by the library.

I have sent an email to the LibreSSL mailing list asking for clarification on 
this point, namely, if this is intended behavior. If it is, there are two ways 
that come to mind to work around this behavior. Both ways would only be 
necessary if `IS_LIBRESSL`.

1. Skip `test_min_max_version`.
2. Instead of testing that ctx is equal *to* the extremes after it's been set 
to one of the extremes, test that it's equal to the actual constants.
   There are two ways this could be accomplished as well:
  a. Use PY_PROTO_{MIN,MAX}IMUM_AVAILABLE, defined in _ssl.c (this may 
require the addition of another call to `PyModule_AddIntConstant` to provide 
access to the constant from _ssl). The downside to this approach is that it 
assumes that `TLS_method()`, or whatever `SSL_METHOD` test_ssl.py uses has 
lower and upper bounds equal to PY_PROTO_{MIN,MAX}IMUM_AVAILABLE, which may not 
always be the case.
  b. Access and store the values for ctx.{min,max}imum_value on creation, 
then reference them after setting.
   Either of these approaches would likely also have the benefit of removing 
the need for `self.assertIn(ctx.minimum_version, {ssl.TLSVersion.TLSv1_2, 
ssl.TLSVersion.TLSv1_3})`.

The test that failed was:
==
FAIL: test_min_max_version (test.test_ssl.ContextTests)
--
Traceback (most recent call last):
  File "/home/alan/src/cpython/Lib/test/test_ssl.py", line 1066, in 
test_min_max_version
ctx.minimum_version, ssl.TLSVersion.MINIMUM_SUPPORTED
AssertionError:  != 

Addendum:
I found the documentation for ssl.TLSVersion.{MAX,MIN}IMUM_SUPPORTED confusing 
at first - it took me quite a while to realize what the purpose of the 
constants were; I would have expected them to contain the maximum and minimum 
protocol versions supported by the library; I see why it was phrased that way, 
after having boned up on ssl.py, _ssl.c, and OpenSSL/LibreSSL, but think it 
could could be made clearer.

--
assignee: docs@python
components: Documentation, SSL, Tests
messages: 320703
nosy: Alan.Huang, alex, christian.heimes, docs@python, dstufft, janssen
priority: normal
severity: normal
status: open
title: test_min_max_version in test_ssl.py fails when Python is built against 
LibreSSL; {min,max}imum_version behavior differs from OpenSSL
type: behavior
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



[issue14117] Turtledemo: exception and minor glitches.

2018-06-28 Thread miss-islington


miss-islington  added the comment:


New changeset 00e05242ae650bc29e8052a5fb79cbb83224a657 by Miss Islington (bot) 
in branch '3.6':
bpo-14117: Make minor tweaks to turtledemo (GH-8002)
https://github.com/python/cpython/commit/00e05242ae650bc29e8052a5fb79cbb83224a657


--

___
Python tracker 

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



[issue14117] Turtledemo: exception and minor glitches.

2018-06-28 Thread miss-islington


miss-islington  added the comment:


New changeset e2c5a753fa3eabe176c34048e3b68674f99386b0 by Miss Islington (bot) 
in branch '3.7':
bpo-14117: Make minor tweaks to turtledemo (GH-8002)
https://github.com/python/cpython/commit/e2c5a753fa3eabe176c34048e3b68674f99386b0


--
nosy: +miss-islington

___
Python tracker 

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



[issue33994] python build egg fails with error while compiling test cases

2018-06-28 Thread Saba Kauser


New submission from Saba Kauser :

Hello,
Everything was working perfectly until recently, may be a week back, when I 
first started to see the error while generating egg for python ibm_db package.
Every time I execute the command : python setup.py bdsit_egg, 
my flow stops with below error:

byte-compiling 
build\bdist.win-amd64\egg\tests\test_131_PrepareExecuteSelectStatementParams.py 
to test_131_PrepareExecuteSelectStatementParams.cpython-36.pyc
error: [Errno 2] No such file or directory: 
'build\\bdist.win-amd64\\egg\\tests\\__pycache__\\test_131_PrepareExecuteSelectStatementParams.cpython-36.pyc.1942660169328'
Please note that, every time I run, the file name is getting appended with a 
random number. e.g 
test_131_PrepareExecuteSelectStatementParams.cpython-36.pyc.1942660169328' when 
the file name placed under tests/__pycache__ should be 
test_131_PrepareExecuteSelectStatementParams.cpython-36.pyc.

There are however other test cases upto test_130* that are getting compiled 
correctly. 
e.g:
byte-compiling 
build\bdist.win-amd64\egg\tests\test_112_FieldNumDiffCaseColNames.py to 
test_112_FieldNumDiffCaseColNames.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_113_DateTest.py to 
test_113_DateTest.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_114_NumericTest_01.py to 
test_114_NumericTest_01.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_115_NumericTest_02.py to 
test_115_NumericTest_02.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_116_ConnActive.py to 
test_116_ConnActive.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_120_FieldName.py to 
test_120_FieldName.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_121_FieldNameAddCol.py to 
test_121_FieldNameAddCol.cpython-36.pyc
byte-compiling 
build\bdist.win-amd64\egg\tests\test_122_FieldNameDiffCaseColNames.py to 
test_122_FieldNameDiffCaseColNames.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_123_FieldNamePos_01.py to 
test_123_FieldNamePos_01.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_124_FieldNamePos_02.py to 
test_124_FieldNamePos_02.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\tests\test_125_FieldNamePos_03.py to 
test_125_FieldNamePos_03.cpython-36.pyc
byte-compiling 
build\bdist.win-amd64\egg\tests\test_130_PrepExecuteSelectStmt.py to 
test_130_PrepExecuteSelectStmt.cpython-36.pyc

Can you guide me on what is leading to this? What is making to have the file 
name appended with random number.

Appreciate your assitance!

Thank you,
Saba.

--
components: Build
messages: 320700
nosy: sabakauser
priority: normal
severity: normal
status: open
title: python build egg fails with error while compiling test cases
type: compile error
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



[issue14117] Turtledemo: exception and minor glitches.

2018-06-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7611

___
Python tracker 

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



[issue14117] Turtledemo: exception and minor glitches.

2018-06-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7610
stage: commit review -> patch review

___
Python tracker 

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



[issue14117] Turtledemo: exception and minor glitches.

2018-06-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 891a1f86d415779cf67ca23e626a868e586feb05 by Terry Jan Reedy in 
branch 'master':
bpo-14117: Make minor tweaks to turtledemo (GH-8002)
https://github.com/python/cpython/commit/891a1f86d415779cf67ca23e626a868e586feb05


--

___
Python tracker 

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



[issue32545] Unable to install Python 3.7.0a4 on Windows 10 - Error 0x80070643: Failed to install MSI package.

2018-06-28 Thread Steve Dower


Steve Dower  added the comment:

We'll need you to attach the logs and try rebooting, as described earlier in 
this thread.

--

___
Python tracker 

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



Re: [OT] Why are BBSes? [was Where's the junk coming from?]

2018-06-28 Thread Terry Reedy

On 6/28/2018 9:05 PM, Avon wrote:

On 06/28/18, Grant Edwards pondered and said...
  
  GE> OK, I've got to ask...

  GE> Why are there still BBSes?
  GE>
  GE> Who even has a modem these days?  [OK, I'll admit my 11 year old
  GE> Thinkpad T500 has a built-in POTS modem, but it's never been used.]

Hi Grant.

How long do you have? :)

Most BBS are connected using the internet these days and mostly run for fun,
nostalgic and curiosity reasons by former and new sysops. Most systems don't
enjoy the caller numbers of the heyday 1990s but rather are largely used by
the sysop to engage in message networks and the BBS community that exists in
2018.

I was a former sysop in my 20s in the 1990s and got back in to it around
2013. What I have found is that the scene is again growing, mostly due to
nostalgia, but also out of a desire to escape big-brother social media e.g
Facebook.


Being able to send messages by ham radio is useful in disasters as well 
as nostalgic.  I just don't know what people are doing these days.



People also like the simple UI for reading messages etc.

As to the how... well, messages / files etc. are now largely sent via the
internet not POTS (plain old telephone) and BinkP is a popular protocol using
port 24554.

BBS software is still under active development by a few authors who have kept
their offerings in step with 2018. So I use Mystic BBS (mysticbbs.com) and
you will see it offers a bunch of services and runs on Linux, Windows,
Raspberry Pi. I also run a message network called fsxNet (fun, simple,
experimental network) that has nodes in USA, New Zealand, Europe, Asia etc.
you can find out more by heading to bbs.nz or download an infopack at
bbs.nz/fsxnet.zip. Lastly info about setting up Mystic can be found on a
YouTube channel I set up called Mystic Guy (there ends the sales pitch :))

Other developers of BBS software active in 2018 include Synchronet BBS, now
offerings including Magicka BBS, Enigma1/2 BBS... and WWIV is still about too.

Hope that helps, perhaps intrigues you further. I'm happy to answer any
questions and/or offer support to folks interested in this stuff. Python is
being added to Mystic as a scripting tool by the author at the moment so this
newsgroup / mail list is of interest to a bunch of folks :)

Best, Paul




--
Terry Jan Reedy

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


[issue14117] Turtledemo: exception and minor glitches.

2018-06-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

PR 8002 fixes the remaining minor problems.

--
stage: patch review -> commit review
versions: +Python 3.6, Python 3.7, Python 3.8 -Python 2.7, Python 3.4, Python 
3.5

___
Python tracker 

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



[issue14117] Turtledemo: exception and minor glitches.

2018-06-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +7609
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



Re: Should nested classes in an Enum be Enum members?

2018-06-28 Thread Ben Finney
Ethan Furman  writes:

> On 06/28/2018 05:58 PM, Ben Finney wrote:
>
> > So I remain dumbfounded as to why anyone would want a class to *both* be
> > an enumerated type, *and* have callable attributes in its API.
>
> Perhaps I am using Enum incorrectly, but here is my FederalHoliday
> Enum. […]

Thanks for the example. Yes, my personal impression is that class
is not a good use of enum.Enum (nor enum.AutoEnum).

To inherit from enum.Enum (or enum.AutoEnum) signals, to my mind, that
the class is not really intended as a typical Python class, but instead
is intended to be that special beast known as an “enumerated type” which
has little behaviour other than being a namespace for constant values.

Adding all that other stuff just makes it quite unclear what the class
means any more.

-- 
 \ “Pinky, are you pondering what I'm pondering?” “I think so, |
  `\ Brain, but me and Pippi Longstocking — I mean, what would the |
_o__)  children look like?” —_Pinky and The Brain_ |
Ben Finney

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


[issue14117] Turtledemo: exception and minor glitches.

2018-06-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

#21884 was closed as a duplicate of #21882 and hence not a separate dependency.

--

___
Python tracker 

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



[issue22051] Turtledemo: stop reloading demos

2018-06-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
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



[issue27500] ProactorEventLoop cannot open connection to ::1

2018-06-28 Thread miss-islington


miss-islington  added the comment:


New changeset c00144cd7741a5060662e85717f6559ad46d02aa by Miss Islington (bot) 
in branch '3.6':
bpo-27500: Fix static version of getaddrinfo to resolve IPv6 (GH-7993)
https://github.com/python/cpython/commit/c00144cd7741a5060662e85717f6559ad46d02aa


--

___
Python tracker 

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



[issue27500] ProactorEventLoop cannot open connection to ::1

2018-06-28 Thread miss-islington


miss-islington  added the comment:


New changeset 3ed44141216aa1d2d8dd7d170c2dc216a6e718b6 by Miss Islington (bot) 
in branch '3.7':
bpo-27500: Fix static version of getaddrinfo to resolve IPv6 (GH-7993)
https://github.com/python/cpython/commit/3ed44141216aa1d2d8dd7d170c2dc216a6e718b6


--
nosy: +miss-islington

___
Python tracker 

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



[issue27500] ProactorEventLoop cannot open connection to ::1

2018-06-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7608

___
Python tracker 

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



[issue27500] ProactorEventLoop cannot open connection to ::1

2018-06-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7607

___
Python tracker 

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



[issue27500] ProactorEventLoop cannot open connection to ::1

2018-06-28 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset d904c238ca3551750cb97d15d827c3e525970867 by Yury Selivanov in 
branch 'master':
bpo-27500: Fix static version of getaddrinfo to resolve IPv6 (GH-7993)
https://github.com/python/cpython/commit/d904c238ca3551750cb97d15d827c3e525970867


--

___
Python tracker 

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



Re: Should nested classes in an Enum be Enum members?

2018-06-28 Thread Ethan Furman

On 06/28/2018 05:58 PM, Ben Finney wrote:


So I remain dumbfounded as to why anyone would want a class to *both* be
an enumerated type, *and* have callable attributes in its API.


Perhaps I am using Enum incorrectly, but here is my FederalHoliday Enum.  Note that date(), next_business_day, and 
year() are all callables.  The AutoEnum parent assigns values from 1 to n for each member.  It's at Stackoverflow [1] if 
you'd like up- or down-vote it.  ;)


---

class FederalHoliday(AutoEnum):
NewYear = "First day of the year.", 'absolute', Month.JANUARY, 1
MartinLutherKingJr = "Birth of Civil Rights leader.", 'relative', 
Month.JANUARY, Weekday.MONDAY, 3
President = "Birth of George Washington", 'relative', Month.FEBRUARY, 
Weekday.MONDAY, 3
Memorial = "Memory of fallen soldiers", 'relative', Month.MAY, 
Weekday.MONDAY, 5
Independence = "Declaration of Independence", 'absolute', Month.JULY, 4
Labor = "American Labor Movement", 'relative', Month.SEPTEMBER, 
Weekday.MONDAY, 1
Columbus = "Americas discovered", 'relative', Month.OCTOBER, 
Weekday.MONDAY, 2
Veterans = "Recognition of Armed Forces service", 'relative', 
Month.NOVEMBER, 11, 1
Thanksgiving = "Day of Thanks", 'relative', Month.NOVEMBER, 
Weekday.THURSDAY, 4
Christmas = "Birth of Jesus Christ", 'absolute', Month.DECEMBER, 25

def __init__(self, doc, type, month, day, occurance=None):
self.__doc__ = doc
self.type = type
self.month = month
self.day = day
self.occurance = occurance

def date(self, year):
"returns the observed date of the holiday for `year`"
if self.type == 'absolute' or isinstance(self.day, int):
holiday =  Date(year, self.month, self.day)
if Weekday(holiday.isoweekday()) is Weekday.SUNDAY:
holiday = holiday.replace(delta_day=1)
return holiday
days_in_month = days_per_month(year)
target_end = self.occurance * 7 + 1
if target_end > days_in_month[self.month]:
target_end = days_in_month[self.month]
target_start = target_end - 7
target_week = list(xrange(start=Date(year, self.month, target_start), 
step=one_day, count=7))
for holiday in target_week:
if Weekday(holiday.isoweekday()) is self.day:
return holiday

@classmethod
def next_business_day(cls, date, days=1):
"""
Return the next `days` business day from date.
"""
holidays = cls.year(date.year)
years = set([date.year])
while days > 0:
date = date.replace(delta_day=1)
if date.year not in years:
holidays.extend(cls.year(date.year))
years.add(date.year)
if Weekday(date.isoweekday()) in (Weekday.SATURDAY, Weekday.SUNDAY) 
or date in holidays:
continue
days -= 1
return date

@classmethod
def year(cls, year):
"""
Return a list of the actual FederalHoliday dates for `year`.
"""
holidays = []
for fh in cls:
holidays.append(fh.date(year))
return holidays

--
~Ethan~


[1] https://stackoverflow.com/a/22594360/208880
--
https://mail.python.org/mailman/listinfo/python-list


Re: [OT] Why are BBSes? [was Where's the junk coming from?]

2018-06-28 Thread Avon
On 06/28/18, Grant Edwards pondered and said...
 
 GE> OK, I've got to ask...
 GE> Why are there still BBSes?
 GE> 
 GE> Who even has a modem these days?  [OK, I'll admit my 11 year old
 GE> Thinkpad T500 has a built-in POTS modem, but it's never been used.]

Hi Grant.

How long do you have? :)

Most BBS are connected using the internet these days and mostly run for fun,
nostalgic and curiosity reasons by former and new sysops. Most systems don't
enjoy the caller numbers of the heyday 1990s but rather are largely used by
the sysop to engage in message networks and the BBS community that exists in
2018.

I was a former sysop in my 20s in the 1990s and got back in to it around
2013. What I have found is that the scene is again growing, mostly due to
nostalgia, but also out of a desire to escape big-brother social media e.g
Facebook.

People also like the simple UI for reading messages etc.

As to the how... well, messages / files etc. are now largely sent via the
internet not POTS (plain old telephone) and BinkP is a popular protocol using
port 24554.

BBS software is still under active development by a few authors who have kept
their offerings in step with 2018. So I use Mystic BBS (mysticbbs.com) and
you will see it offers a bunch of services and runs on Linux, Windows,
Raspberry Pi. I also run a message network called fsxNet (fun, simple,
experimental network) that has nodes in USA, New Zealand, Europe, Asia etc.
you can find out more by heading to bbs.nz or download an infopack at
bbs.nz/fsxnet.zip. Lastly info about setting up Mystic can be found on a
YouTube channel I set up called Mystic Guy (there ends the sales pitch :))

Other developers of BBS software active in 2018 include Synchronet BBS, now
offerings including Magicka BBS, Enigma1/2 BBS... and WWIV is still about too.

Hope that helps, perhaps intrigues you further. I'm happy to answer any
questions and/or offer support to folks interested in this stuff. Python is
being added to Mystic as a scripting tool by the author at the moment so this
newsgroup / mail list is of interest to a bunch of folks :)

Best, Paul

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


Re: Where's the junk coming from?

2018-06-28 Thread Avon
On 06/28/18, Tim Golden pondered and said...
 
 TG> (Wearing my List Moderator hat)
 TG> 
 TG> Thanks very much for addressing this for us, and to Cameron and others
 TG> who did the detective work. I admit I assumed at first it was some kind
 TG> of odd attack perhaps related to a dissatisfied poster so I'm glad it
 TG> was a misconfiguration issue.

Hi Tim.

You're most welcome. I try to jump on anything amiss as soon as I know about
it. At the time of posting this reply I have not re-linked the node with the
issue to my NNTP server but will likely do so in a few more days time. I just
want to give him some time to sort his end out first :)

Best wishes from New Zealand

Cheers, Paul.

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


Re: Should nested classes in an Enum be Enum members?

2018-06-28 Thread Steven D'Aprano
On Thu, 28 Jun 2018 20:34:58 +1000, Ben Finney wrote:

> Ethan Furman  writes:
> 
>> Consider the following Enum definition:
>>
>>   class Color(Enum):
>>   RED = 1
>>   GREEN = 2
>>   BLUE = 3
>>   @property
>>   def lower(self):
>>   return self.name.lower()
>>   def spam(self):
>>   return "I like %s eggs and spam!" % self.lower
>>   class SomeClass:
>>   pass
> 
> That dumbfounds my intuitions.
> 
> Specifically, I can't make sense of why someone would want to have a
> class that is simultaneously behaving as an enumerated type, *and* has
> an API of custom callable attributes.


The PEP gives an example of enumerated members that themselves have 
methods.

https://www.python.org/dev/peps/pep-0435/


There was another example somewhere (I don't remember where) of an 
enumeration of the planets, where planets can have attributes and methods:

Planet.MARS.mass
Planet.JUPITER.moons()


which is no more weird than this:

class Planet(Enum):
MARS = "the red planet"

Planet.MARS.upper()


-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-28 Thread Dan Stromberg
On Thu, Jun 28, 2018 at 1:27 PM, Marko Rauhamaa  wrote:

> Dan Stromberg :
> > On Wed, Jun 27, 2018 at 10:31 PM, Marko Rauhamaa 
> wrote:
> >> Dan Stromberg :
> >> >> > The problem can be solved by turning on the SO_REUSEADDR flag of
> >> >> > the socket.
> >> > BTW, it's a security feature you're turning off. If you're on a
> >> > multiuser box, it prevents a second user from stealing lingering
> >> > connections from a first user on the same port.
> >>
> >> Can you provide a brief proof of concept?
> >>
> > https://stackoverflow.com/questions/19960475/problems-
> related-to-so-reuseaddr
>
> I'm sorry but I couldn't find a working example behind the link. Could
> you demonstrate the problem with a few lines of Python.

It's more practical to use English:

Start an echo server process P that listens on tcp/.

Initiate a connection from a client machine to process P at tcp/. It
works as expected.

Kill P.

Initiate a connection from a client machine to process P at tcp/.  It
gives a connection refused as expected.

If someone else comes along soon after and starts a different echo server
process Q at tcp/ on the same server, it starts up immediately if P
used SO_REUSEADDR.

Then initiate a connection from the same (or different) client machine to
process P (which no longer exists).  Q gets the data intended for P.

Naturally, for an echo server, we're just illustrating. But if it were a
daemon that supports password-based authentication, it could be a problem.

As security issues go, it's not the most severe one you'll ever see.  It
pretty much assumes there are people on your server who you don't trust.

This is not Python-specific.

That's about all I have the patience for.  I'm not sure I'm going to write
a few programs to demonstrate the issue.  It's really not a "few lines of
python".
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33993] zipfile module weird behavior when used with zipinfo

2018-06-28 Thread Micheal Gardner

New submission from Micheal Gardner :

when i want to zip a empty folder, i use following code

```

import zipfile

zfile = zipfile.ZipFile("tmp.zip",'w')
zif = zipfile.ZipInfo("tmp/")
zfile.writestr(zif,"")
zfile.close()
```

but in this case, things become weird.

```
# 先造一个测试文件夹
mkdir /tmp/test_folder/
touch /tmp/test_folder/test.md
```

```
import zipfile
file_path = "/tmp/test_folder/test.md"
rel_name = "test.md"
zfile = zipfile.ZipFile("tmp.zip",'w')
zif = zipfile.ZipInfo("tmp/")
zfile.writestr(zif,"")
zfile.write(file_path, rel_name)
zfile.close()
```

decompression expect 

```
$ tree tmp
tmp
├── test.md

1 file
```

decompression actual

```
$ tree tmp
tmp
├── test.md
└── tmp

1 directory, 1 file
```

--

___
Python tracker 

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



Re: Should nested classes in an Enum be Enum members?

2018-06-28 Thread Steven D'Aprano
On Thu, 28 Jun 2018 08:36:47 -0700, Ethan Furman wrote:

>>> Answer:
>>>
>>> - RED, GREEN, and BLUE are members
>>> - lower and spam() are not
>>> - SomeClass /is/ a member (but not its instances)
>>
>> Is that by accident or by design?
> 
> By design.  It is entirely possible to want an enum of types (int,
> float, str, etc.).

Seems strange to me. Why enum of types but not an enum of functions or 
methods?

Perhaps you could have had an explicit decorator?


class Colours(Enum):
RED = 1

class Spam(object):
pass

@Enum.member
class Eggs(object):
pass


Colours.Eggs will be an enum member, Spam will not be.

But I suppose backwards compatibility rules that out.



>> class Colour(Enum):
>>  class PrimaryColour(Enum):
>>  RED = 1
>>  GREEN = 2
>>  BLUE = 3
>>  OCTARINE = 8
>>  class SecondaryColour(Enum):
>>  PUCE = 101
>>  MAUVE = 102
>>  BEIGE = 103
>>  TEAL = 104
> 
> This really seems to be the sticking point -- what should an Enum of
> Enums look like?  For example, should the above do
> 
>--> list(Colour)
>[Colour.PrimaryColour <...>, Colour.SecondaryColour <...>]
> 
> or something else?

I would expect the inner classes to disappear:

[Colour.RED, Colour.GREEN, ... Colour.PUCE, ... ]

unless I explicitly inspect their types:

type(Colour.RED)
=> returns Colour.PrimaryColour


But maybe there's another way to get that same effect?

# ???
class PrimaryColour(Enum):
RED = 1
...
class SecondaryColour(Enum):
...

Colour = PrimaryColour + SecondaryColour




-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: Should nested classes in an Enum be Enum members?

2018-06-28 Thread Ben Finney
Ian Kelly  writes:

> On Thu, Jun 28, 2018 at 4:38 AM Ben Finney  wrote:
> >
> > Ethan Furman  writes:
> >
> > Specifically, I can't make sense of why someone would want to have a
> > class that is simultaneously behaving as an enumerated type, *and*
> > has an API of custom callable attributes.
>
> You don't see value in enum members having properties?

Is a Python property a callable attribute?

>>> class Lorem:
... @property
... def spam(self):
... print(self)
... 
>>> foo = Lorem()
>>> foo.spam()
<__main__.Lorem object at 0x7ff5078bc710>
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'NoneType' object is not callable

It seems that no, a property is not a callable attribute.

So I remain dumbfounded as to why anyone would want a class to *both* be
an enumerated type, *and* have callable attributes in its API.

-- 
 \  “It's dangerous to be right when the government is wrong.” |
  `\   —Francois Marie Arouet Voltaire |
_o__)  |
Ben Finney

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


[issue33993] zipfile module weird behavior when used with zipinfo

2018-06-28 Thread Micheal Gardner


Change by Micheal Gardner :


--
components: Library (Lib)
nosy: Micheal Gardner
priority: normal
severity: normal
status: open
title: zipfile module weird behavior when used with zipinfo
type: behavior
versions: Python 2.7, Python 3.6

___
Python tracker 

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



Re: I lost nearly all my modules installing 3.7

2018-06-28 Thread Terry Reedy

On 6/28/2018 6:45 PM, Elliott Roper wrote:

On 28 Jun 2018, Terry Reedy wrote



There is a pip command for making an editable file of installed
packages. Run that in 3.6, perhaps after updating everything.


There is another pip command for using that file to install everything
listed. Run that in 3.7.


I can't see the pip commands you mention for writing a file from 3.6

 and

reading it back for 3.7
Is it pip freeze -r   followed by pip install -r? If so, what is
meant by 'the given requirements file' in the freeze options?


'pip freeze' sends the requirements list to stdout in alphabetical 
order.  You redirect or copy-paste to a file.  I have not done this, but 
apparently -r  uses file as a template for selecting and ordering 
the requirements.  I presume pip will ignore any versions in the 
template and list the actual installed versions.


I believe you got the install right.


When I look inside site-packages in ~/Library (see below) I see many packages
that pip lists, but by no means all. F'instance numpy and scipy. They can be
found in /Library's site-packages however.




My understanding is that the whole $PATH is searched in order to resolve an
import, but it isn't.


The OS searches the OS path, which you listed above.
Python searches its sys.path, which it creates when started.
Run >>>  import sys; sys.path to see the contents.
Unless macOS is more different than I think, you should see a 3.7
site-packages when running 3.7.


Aha! That is most helpful

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(python prompt)>>>  import sys
.>>>sys.path
['', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', #
no such file


sys.path included directories that might be present.  In this case, a 
zipped version of the stdlib.



'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', # 207
items, none matching pip intstallable modules
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-
dynload',# 69 items, none matching pip installable modules
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages'] # just pip and setuptools are in here
.>>>  ^D


site-packages is the default for 3rd parth packages.  It can have .pth 
files that extend the directory to effectively include other directories.



EiPro:~ elliott$ python3.6
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
.>>>  import sys
(python prompt)>>>  sys.path
['', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', #
no such file
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', # 207
items, none matching pip intstallable modules
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-
dynload',# 65 items, none matching pip installable modules
'/Users/elliott/Library/Python/3.6/lib/python/site-packages', # 103 items
some matching items that appear in pip3.6 list
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages'] # numpy, scipy, pandas etc. are here. These might have been
modules I needed sudo -H to update
.>>>

What I did not make clear that my 'elliott' user is not an Administrator. If
I log into my admin account (which I hardly ever do), it thinks my Python3 is
3.7, list there also shows the hugely abbreviated collection of modules
namely pip and setuptools. pip list shows a list of modules so old as to be
unrecognisable.


I expect the system install to be 2.7, python3 link to 3.7 either 
because that is the most recent 3x installed or the most recent version.



It looks like I have a tangled mess. Is there a way of getting rid of all the
pythons except Apple's museum piece and starting again? It is a hobby for me.
I have no need for backward compatibility. I think if I could install 3.7
site wide from my non-admin account, I would be happiest. The standard
install pretty much worked up to 3.6
pip
Would it be safe to delete everything on python's sys.path and re-install
from the download .pkg


I suspect you can get rid of 3.6, 3.5, 3.4, but I am not a Mac user.  I 
hope someone who is answers.


--
Terry Jan Reedy

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


Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-28 Thread Steven D'Aprano
On Thu, 28 Jun 2018 23:27:38 +0300, Marko Rauhamaa wrote:

> Dan Stromberg :
>> On Wed, Jun 27, 2018 at 10:31 PM, Marko Rauhamaa 
>> wrote:
>>> Dan Stromberg :
>>> >> > The problem can be solved by turning on the SO_REUSEADDR flag of
>>> >> > the socket.
>>> > BTW, it's a security feature you're turning off. If you're on a
>>> > multiuser box, it prevents a second user from stealing lingering
>>> > connections from a first user on the same port.
>>>
>>> Can you provide a brief proof of concept?
>>>
>> https://stackoverflow.com/questions/19960475/problems-related-to-so-
reuseaddr
> 
> I'm sorry but I couldn't find a working example behind the link. Could
> you demonstrate the problem with a few lines of Python.

Do you think attackers are limited to a few lines of Python?

If you are asking from academic curiosity, limited by care factor ("I 
care about this enough to read a few lines of Python but not 100 lines or 
20 lines of C...") that's fair enough.

But if you're trying to express skepticism that this is a genuine 
concern, then "a few lines of Python" is an unreasonable limitation.




-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: configparser v/s file variables

2018-06-28 Thread Jim Lee



On 06/28/18 16:44, Steven D'Aprano wrote:



I agree with you that it's a bad idea.

Aside from the little fact that you described concerns about using Python
code for settings as "silly".



Umm, no.  I said that worrying about arbitrary code execution in an 
interpreted language seemed silly.  Please be more accurate in your 
paraphrases.




Data validation is a red herring: it is no more or less necessary to
validate user settings regardless of their source. Whether they come from
reading an INI file or from importing a Python file, you still need to
check that they have valid values.


You are making a strawman argument, since you are (again) 
misrepresenting what I said.  Therefore, I will give you no more 
opportunities.


-Jim

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


[issue33991] lib2to3 should parse f-strings

2018-06-28 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I'm curious how you are getting f-strings (introduced in Python 3.6) in Python 
2 code that you are passing to 2to3.

--
nosy: +steven.daprano

___
Python tracker 

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



Re: configparser v/s file variables

2018-06-28 Thread Steven D'Aprano
On Thu, 28 Jun 2018 10:58:36 -0700, Jim Lee wrote:

> On 06/28/18 07:30, Grant Edwards wrote:
>> I still maintain it's a bad idea to run arbitrary code found in
>> user-edited config files.
>>
>> There may be cases where somebody has figured out how to muck with a
>> config file that's shared among multiple users, or has tricked somebody
>> into including something from an untrusted source in an include file.
>>
>> Or there could be users who don't know what they're doing and
>> unwittingly type something harmful into a config file:
>>
>>bad_command = os.system("rm -rf ~/*")
>>
>> Yes, I know, users would never be that dumb...
>>
> I agree with you that it's a bad idea.

Aside from the little fact that you described concerns about using Python 
code for settings as "silly".


> I was pointing out that I look
> at it from an input validation viewpoint rather than a security
> viewpoint - that's all.

You have made it abundantly clear that you aren't thinking about security.


> Absolute security isn't a solvable problem.  It isn't even a technical
> problem.  But that's a discussion for another time...


Nobody is talking about "absolute security".

We're talking about *one* aspect of security: given the need to collect 
user-supplied settings, is it acceptable to get the settings from 
executable Python code?

Data validation is a red herring: it is no more or less necessary to 
validate user settings regardless of their source. Whether they come from 
reading an INI file or from importing a Python file, you still need to 
check that they have valid values.




-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


[issue33992] Compilation fails on AMD64 Windows8.1 Non-Debug 3.6: The Windows SDK version 10.0.15063.0 was not found

2018-06-28 Thread Zachary Ware


Zachary Ware  added the comment:

Sorry, this seems to have been due to updates on the machine.  It's now fixed.

--
keywords: +buildbot
resolution:  -> fixed
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



[issue33992] Compilation fails on AMD64 Windows8.1 Non-Debug 3.6: The Windows SDK version 10.0.15063.0 was not found

2018-06-28 Thread STINNER Victor


New submission from STINNER Victor :

Build FAILED.
   "D:\buildarea\3.6.ware-win81-release\build\PCbuild\pcbuild.proj" (Build 
target) (1) ->
   "D:\buildarea\3.6.ware-win81-release\build\PCbuild\pythoncore.vcxproj" 
(Build target) (2) ->
   (Desktop_PlatformPrepareForBuild target) -> 
 C:\Program Files 
(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5):
 error MSB8036: The Windows SDK version 10.0.15063.0 was not found. Install the 
required version of Windows SDK or change the SDK version in the project 
property pages or by right-clicking the solution and selecting "Retarget 
solution". 
[D:\buildarea\3.6.ware-win81-release\build\PCbuild\pythoncore.vcxproj]
0 Warning(s)
1 Error(s)

--
components: Tests
messages: 320689
nosy: vstinner, zach.ware
priority: normal
severity: normal
status: open
title: Compilation fails on AMD64 Windows8.1 Non-Debug 3.6: The Windows SDK 
version 10.0.15063.0 was not found
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



Re: I lost nearly all my modules installing 3.7

2018-06-28 Thread Elliott Roper
On 28 Jun 2018, Terry Reedy wrote
(in article):

> On 6/28/2018 1:08 PM, Elliott Roper wrote:
> > I have done something stupid. Don't know what.
>
> It appears that you ran 3.7 expecting that modules installed for 3.6
> would magically be available for 3.7.
Yes indeed. It worked for 3.4, 3.5, and 3.6
>
>
> There is a pip command for making an editable file of installed
> packages. Run that in 3.6, perhaps after updating everything.
>
>
> There is another pip command for using that file to install everything
> listed. Run that in 3.7.

I can't see the pip commands you mention for writing a file from 3.6 and 
reading it back for 3.7
Is it pip freeze -r   followed by pip install -r? If so, what is 
meant by 'the given requirements file' in the freeze options?
>
>
> > My $PATH looks like this
> > XXXMac:~ elliott$ echo $PATH
> > /Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Py
> > th
> > on.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/
> > 3.
> > 5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/elliott/b
> > in
> > > /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local
> > > /MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/git/bin
> >
> > pip3 list or pip3.7 list gives me
> > Package Version
> > -- ---
> > pip 10.0.1
> > setuptools 39.0.1
>
> This is the content of the 3.7 site-packages.
>
> > > > > import numpy as np
> > Traceback (most recent call last):
> > File "", line 1, in 
> > ModuleNotFoundError: No module named 'numpy'
> > So it is not lying to me!!!
> >
> > pip list or pip3.6 list
> > gives the whole caboodle I was expecting with a far smaller version number
> > for setuptools.
>
> The content of the 3.6 site-packages directory.

When I look inside site-packages in ~/Library (see below) I see many packages 
that pip lists, but by no means all. F'instance numpy and scipy. They can be 
found in /Library's site-packages however.
>
>
> > My understanding is that the whole $PATH is searched in order to resolve an
> > import, but it isn't.
>
> The OS searches the OS path, which you listed above.
> Python searches its sys.path, which it creates when started.
> Run >>>  import sys; sys.path to see the contents.
> Unless macOS is more different than I think, you should see a 3.7
> site-packages when running 3.7.

Aha! That is most helpful

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(python prompt)>>>  import sys
.>>>sys.path
['', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', # 
no such file 
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', # 207 
items, none matching pip intstallable modules 
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-
dynload',# 69 items, none matching pip installable modules
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages'] # just pip and setuptools are in here
.>>>  ^D

EiPro:~ elliott$ python3.6
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
.>>>  import sys
(python prompt)>>>  sys.path
['', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', # 
no such file 
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', # 207 
items, none matching pip intstallable modules 
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-
dynload',# 65 items, none matching pip installable modules
'/Users/elliott/Library/Python/3.6/lib/python/site-packages', # 103 items 
some matching items that appear in pip3.6 list 
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages'] # numpy, scipy, pandas etc. are here. These might have been 
modules I needed sudo -H to update
.>>>

What I did not make clear that my 'elliott' user is not an Administrator. If 
I log into my admin account (which I hardly ever do), it thinks my Python3 is 
3.7, list there also shows the hugely abbreviated collection of modules 
namely pip and setuptools. pip list shows a list of modules so old as to be 
unrecognisable.

It looks like I have a tangled mess. Is there a way of getting rid of all the 
pythons except Apple's museum piece and starting again? It is a hobby for me. 
I have no need for backward compatibility. I think if I could install 3.7 
site wide from my non-admin account, I would be happiest. The standard 
install pretty much worked up to 3.6
pip
Would it be safe to delete everything on python's sys.path and re-install 
from the download .pkg
>
>
> > It might be relevant that I have had a bit of hassle installing module
> > updates in the past. I would get an error saying the module version being
> > replaced could not be deleted with permissions errors which I 

[issue29097] [Windows] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2018-06-28 Thread STINNER Victor


Change by STINNER Victor :


--
title: datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6 -> 
[Windows] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

___
Python tracker 

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



Re: [OT] Why are BBSes? [was Where's the junk coming from?]

2018-06-28 Thread Jim Lee



On 06/28/18 11:45, Grant Edwards wrote:

On 2018-06-28, Jim Lee  wrote:


On 06/28/18 07:34, Grant Edwards wrote:

OK, I've got to ask...

Why are there still BBSes?

Who even has a modem these days?  [OK, I'll admit my 11 year old
Thinkpad T500 has a built-in POTS modem, but it's never been used.]


BBS's are most often connected to via telnet these days.  There are
still hundreds (if not thousands) of them.

Interesting.  In my exerience a BBS was just a poor substitute for an
FTP site, a mailing list and Usenet.

I'm a little baffled as to what "added value" they provide these days,
but people are probably equally baffled why I choose to participate in
mailing lists via a text-mode NNTP client rather that some
pointy-clicky app or website.

Added value?  BBS, Usenet, IRC, Twitter, whatever - they're all just 
forms of communication.


BBS's were around before ARPANET became the Internet - before ftp, 
usenet, http, and personal computers.  I first started using them in 
1976-77 (with a 300 baud modem and a VT-52 terminal), and ran my own in 
the 80's and 90's - first on a PDP-11/23, then a Commodore 64 and later 
on an Amiga.  Some people like to keep that tradition alive.


-Jim

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


[issue33945] concurrent.futures ProcessPoolExecutor submit() blocks on results being written

2018-06-28 Thread Daniel Barcay


Daniel Barcay  added the comment:

Just got the drop of the python3.7 release. I can confirm that this is fixed in 
python3.7 in my workload.

Nice job! Thanks for changing the mechanism of thread-sync. I'm grateful.

--
resolution:  -> fixed
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



[issue33963] IDLE macosx: add tests.

2018-06-28 Thread Mark Roseman


Change by Mark Roseman :


--
assignee:  -> terry.reedy
components: +IDLE
nosy: +markroseman

___
Python tracker 

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



[issue33991] lib2to3 should parse f-strings

2018-06-28 Thread skreft


New submission from skreft :

Currently f-strings are parsed just as regular strings by lib2to3. However, 
this has the problem that the invariant of a string node being a literal is now 
broken.

This poses two problems. On one hand, if I want to compare that two string 
nodes are equivalent I would need to do something like:

def string_nodes_are_eqivalent(node1, node2):
  if is_f_string(node1) and is_f_string(node2):
# This would require to parse the nodes using ast.parse
return f_strings_are_equivalent(node1, node2)
  if not is_f_string(node1) and not is_f_string(node2):
return ast.literal_eval(node1.value) == ast.literal_eval(node2.value)
  return False

Note that ast.literal_eval does not accept f-strings.
Also note that ast.parse returns an ast.JoinedString for f-strings, whose 
elements are either ast.Str or ast.FormattedValue, the latter being ast 
expressions.

On the other hand, this has the problem of not being able to refactor the 
expressions inside an f-string.

--
messages: 320687
nosy: skreft
priority: normal
severity: normal
status: open
title: lib2to3 should parse f-strings

___
Python tracker 

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



[ANN] PyYAML-4.1: ***RETRACTED***

2018-06-28 Thread Ingy dot Net
I am sorry to report that the PyYAML-4.1 release from 48 hours ago has been
removed from PyPI

There were too many problems to make this a viable release.

The biggest known issue with this retraction is that PyYAML will not work
with the new Python 3.7  until PyYAML-4.2 is released.
https://github.com/yaml/pyyaml/issues/126#issuecomment-401175258

We are starting work immediately on 4.2b1 prerelease series. I hope to see
4.2 released in the next few days.

Work is being coordinated on #pyyaml on irc.freenode.net and issues can be
reported and followed at https://github.com/yaml/pyyaml

Thank you for your patience.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23544] IDLE hangs when selecting Stack View with debug active

2018-06-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This crashes or hangs the user execution process, but not the IDLE process.  So 
Shell => 'Restart Shell   cntl-F6' still works.

--
versions: +Python 3.6, Python 3.7, Python 3.8 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue33990] CPPFLAGS during ./configure are not passed-through in sysconfig.customize_compiler

2018-06-28 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

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



Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-28 Thread Marko Rauhamaa
Dan Stromberg :
> On Wed, Jun 27, 2018 at 10:31 PM, Marko Rauhamaa  wrote:
>> Dan Stromberg :
>> >> > The problem can be solved by turning on the SO_REUSEADDR flag of
>> >> > the socket.
>> > BTW, it's a security feature you're turning off. If you're on a
>> > multiuser box, it prevents a second user from stealing lingering
>> > connections from a first user on the same port.
>>
>> Can you provide a brief proof of concept?
>>
> https://stackoverflow.com/questions/19960475/problems-related-to-so-reuseaddr

I'm sorry but I couldn't find a working example behind the link. Could
you demonstrate the problem with a few lines of Python.


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


[issue33983] unify types for lib2to3.pytree.Base.children

2018-06-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Concatenating list and tuple (or tuple and list) you can write as:

grandchildren = [*node.children[0].children, *node.children[1].children]

The only list methods not available for tuples are mutating methods (using them 
with a shared empty list would be a bug), and copy() (a[:] and list(a) work 
with both lists and tuples).

>>> sorted(set(dir(list)) - set(dir(tuple)))
['__delitem__', '__iadd__', '__imul__', '__reversed__', '__setitem__', 
'append', 'clear', 'copy', 'extend', 'insert', 'pop', 'remove', 'reverse', 
'sort']

--

___
Python tracker 

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



Re: EXTERNAL: OSError: [Errno 48] Address already in use

2018-06-28 Thread Dan Stromberg
On Wed, Jun 27, 2018 at 10:31 PM, Marko Rauhamaa  wrote:

> Dan Stromberg :
> >> > The problem can be solved by turning on the SO_REUSEADDR flag of
> >> > the socket.
> > BTW, it's a security feature you're turning off. If you're on a
> > multiuser box, it prevents a second user from stealing lingering
> > connections from a first user on the same port.
>
> Can you provide a brief proof of concept?
>
https://stackoverflow.com/questions/19960475/problems-related-to-so-reuseaddr
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33990] CPPFLAGS during ./configure are not passed-through in sysconfig.customize_compiler

2018-06-28 Thread Eric N. Vander Weele


Change by Eric N. Vander Weele :


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

___
Python tracker 

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



[issue24575] timemodule build fail - missing definitions for _Py_BEGIN_SUPPRESS_IPH and _Py_END_SUPPRESS_IPH

2018-06-28 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

I ran into an error like this and perhaps I have a clue was why some people run 
into it.  Dynamic modules built from Modules/Setup will need to have  
-DPy_BUILD_CORE defined within the Setup file in the case they need to use the 
_Py_BEGIN_SUPPRESS_IPH macro.

The Setup file is generated on figure 'configure' but it is not removed if you 
run "make clean".  So, if it gets generated without the Py_BUILD_CORE flags in 
it, you will get this mysterious build error.

Perhaps Modules/makesetup should be intelligent and add the Py_BUILD_CORE flags 
as needed.  One idea is to check the path of the source code (e.g. 
timemodule.c) and if the source is within the code interpreter folder,  add the 
BUILD_CORE flag.

Not sure about other platform build systems.  It looks like PCbuild does 
something different as it doesn't use makesetup.

--
nosy: +nascheme

___
Python tracker 

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



[issue33990] CPPFLAGS during ./configure are not passed-through in sysconfig.customize_compiler

2018-06-28 Thread Eric N. Vander Weele


New submission from Eric N. Vander Weele :

When specifying CPPFLAGS during `./configure`, 
`sysconfig.get_config_var('CPPFLAGS')` does capture the originally specified 
flags.  However, when building a C/C++ extension, any flags specified via 
CPPFLAGS are not present during compilation of extension source files.

Since preprocessor flags (e.g., '-I' rules) may be used during `./configure` 
instead of `CFLAGS`, it appears that the `CPPFLAGS` captured should also be 
injected when customizing the compiler executable to be invoked.

I have PR that will be submitted and linked shortly.

--
components: Build, Distutils
messages: 320683
nosy: dstufft, eric.araujo, ericvw
priority: normal
severity: normal
status: open
title: CPPFLAGS during ./configure are not passed-through in 
sysconfig.customize_compiler
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, 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



Re: OSError: [Errno 48] Address already in use

2018-06-28 Thread Dan Stromberg
On Wed, Jun 27, 2018 at 8:49 AM, T Berger  wrote:

> Why am I getting this error? I'm not sure what additional information I
> need to supply, so please let me know.


AIUI, there are 2 possible causes.  You either have some other process
listening on the requested port, or a process that Was using it no longer
is but not enough time has passed yet for the kernel to decide that the
port can safely be reused.

The former keeps two processes from trying to get data from the same port
at the same time, which could be confusing.

The latter is a security feature.  It keeps person A from starting an imap
server on port tcp/, and having person B come along and start a fake,
password-stealing imap server on the same port shortly after person A
terminates theirs (for example). There would otherwise be a window of time
during which B's imap daemon could steal passwords intended for A's imap
daemon, because remote imap clients wouldn't know about the switcheroo.
Note that even if A come back and starts their imap daemon immediately
after a crash, the kernel doesn't know if that is a legitimate or
illegitemate imap daemon, so that is blocked for a while too.

You can check if something else is listening on that port with
http://stromberg.dnsalias.org/~strombrg/What-program-is-active-on-that-port.html
(Linux and Solaris - there will likely be similar tools for other OS's).

You can eliminate the waiting period with SO_REUSEADDR (but if you have
something else listening on that port, then don't!). Example:
http://stromberg.dnsalias.org/~strombrg/max-tcp-window.html

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


Re: [OT] Why are BBSes? [was Where's the junk coming from?]

2018-06-28 Thread Grant Edwards
On 2018-06-28, Jim Lee  wrote:
>
>
> On 06/28/18 07:34, Grant Edwards wrote:
>> OK, I've got to ask...
>>
>> Why are there still BBSes?
>>
>> Who even has a modem these days?  [OK, I'll admit my 11 year old
>> Thinkpad T500 has a built-in POTS modem, but it's never been used.]
>>
> BBS's are most often connected to via telnet these days.  There are 
> still hundreds (if not thousands) of them.

Interesting.  In my exerience a BBS was just a poor substitute for an
FTP site, a mailing list and Usenet.

I'm a little baffled as to what "added value" they provide these days,
but people are probably equally baffled why I choose to participate in
mailing lists via a text-mode NNTP client rather that some
pointy-clicky app or website.

-- 
Grant Edwards   grant.b.edwardsYow! Used staples are good
  at   with SOY SAUCE!
  gmail.com

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


[issue33983] unify types for lib2to3.pytree.Base.children

2018-06-28 Thread John Reese


John Reese  added the comment:

The problem I'm trying to solve is around functions that operate on a 
Union[Leaf, Node], and want to be able to do things like `grandchildren = 
node.children[0].children + node.children[1].children` (contrived example, but 
point being tuple+list=TypeError while list+tuple=OK).  There are similar cases 
around list methods not being available for tuples.  In both cases, as is, the 
function needs to do some amount of type checking at runtime of each child to 
determine what operations can be done.  Also, IMO, from a type annotation 
perspective, having a child class that uses a different type for an attribute 
from the base class is an anti-pattern, or weird at best.

re. error prone:  Since the expectation in lib2to3 is already that fixers 
shouldn't be modifying `node.children` directly, I don't see how this makes 
anything more error prone.  Base/Leaf objects lack those methods for 
modifications, so unless the code is already being a bad actor, the situation 
isn't changed.

--

___
Python tracker 

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



Re: configparser v/s file variables

2018-06-28 Thread Jim Lee



On 06/28/18 07:30, Grant Edwards wrote:

I still maintain it's a bad idea to run arbitrary code found in
user-edited config files.

There may be cases where somebody has figured out how to muck with a
config file that's shared among multiple users, or has tricked
somebody into including something from an untrusted source in an
include file.

Or there could be users who don't know what they're doing and
unwittingly type something harmful into a config file:

   bad_command = os.system("rm -rf ~/*")

Yes, I know, users would never be that dumb...

I agree with you that it's a bad idea.  I was pointing out that I look 
at it from an input validation viewpoint rather than a security 
viewpoint - that's all.


Absolute security isn't a solvable problem.  It isn't even a technical 
problem.  But that's a discussion for another time...


-Jim

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


Re: [OT] Why are BBSes? [was Where's the junk coming from?]

2018-06-28 Thread Jim Lee



On 06/28/18 07:34, Grant Edwards wrote:

OK, I've got to ask...

Why are there still BBSes?

Who even has a modem these days?  [OK, I'll admit my 11 year old
Thinkpad T500 has a built-in POTS modem, but it's never been used.]

BBS's are most often connected to via telnet these days.  There are 
still hundreds (if not thousands) of them.


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


[issue33985] ContextVar does not have a "name" attribute

2018-06-28 Thread Yury Selivanov


Change by Yury Selivanov :


--
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



Re: configparser v/s file variables

2018-06-28 Thread Jim Lee



On 06/28/18 00:46, Steven D'Aprano wrote:


Yes, attacks by trusted insiders are the hardest to defend against.
Betrayal of trust sucks. Trusted users with sufficient privileges could
just modify the source code of your application or of Python itself. They
could also attack your system in a thousand different ways.

But what about untrusted users with fewer privileges? They *can't* modify
the source code of your application, or change the password on other
accounts, or read arbitrary files, or masquerade as other users. Because
they have unprivileged accounts.

So why give them the ability to escalate their privilege to that of your
application (which probably can do lots of things they can't do) by
directly executing Python code they supply?


???  I don't follow.  I never suggested allowing someone the ability to 
directly execute user-supplied Python code.  However, if they have the 
privileges necessary to run the application, I don't see the security 
risk.  Many applications have embedded scripting engines that do just that.



Your argument is akin to:

"I gave my partner a key to my house, and they could rob me blind if they
want. Since I trust them not to, there's no point in locking the door to
the house when I go out, since they have a key."



Not exactly.  The original question was about reading config variables 
from a file in Python.  That sort of thing didn't suggest (to me) a 
world-facing web app or other security-conscious situation.


It's more like leaving the door unlocked while I'm home...

-Jim

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


[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2018-06-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset 9d92524c11def666a78ff57a9603a9ad6142418a by Steve Dower (Miss 
Islington (bot)) in branch '3.7':
bpo-31546: Fix input hook integration (GH-7978)
https://github.com/python/cpython/commit/9d92524c11def666a78ff57a9603a9ad6142418a


--

___
Python tracker 

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



Re: I lost nearly all my modules installing 3.7

2018-06-28 Thread Terry Reedy

On 6/28/2018 1:08 PM, Elliott Roper wrote:

I have done something stupid. Don't know what.


It appears that you ran 3.7 expecting that modules installed for 3.6 
would magically be available for 3.7.


There is a pip command for making an editable file of installed 
packages.  Run that in 3.6, perhaps after updating everything.


There is another pip command for using that file to install everything 
listed.  Run that in 3.7.



My $PATH looks like this
XXXMac:~ elliott$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Pyth
on.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.
5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/elliott/bin
:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/git/bin

pip3 list or pip3.7 list gives me
Package Version
-- ---
pip 10.0.1
setuptools 39.0.1


This is the content of the 3.7 site-packages.


import numpy as np

Traceback (most recent call last):
File "", line 1, in 
ModuleNotFoundError: No module named 'numpy'
So it is not lying to me!!!

pip list or pip3.6 list
gives the whole caboodle I was expecting with a far smaller version number
for setuptools.


The content of the 3.6 site-packages directory.


My understanding is that the whole $PATH is searched in order to resolve an
import, but it isn't.


The OS searches the OS path, which you listed above.
Python searches its sys.path, which it creates when started.
Run >>> import sys; sys.path to see the contents.
Unless macOS is more different than I think, you should see a 3.7 
site-packages when running 3.7.



It might be relevant that I have had a bit of hassle installing module
updates in the past. I would get an error saying the module version being
replaced could not be deleted with permissions errors which I resolved with a
bit of sudo -H.

Python 3.6 is still working properly when invoked explicitly




--
Terry Jan Reedy

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


[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2018-06-28 Thread miss-islington


miss-islington  added the comment:


New changeset 0ebd1bc94a941a5044e26de946c1100d652dfe46 by Miss Islington (bot) 
in branch '3.6':
bpo-31546: Fix input hook integration (GH-7978)
https://github.com/python/cpython/commit/0ebd1bc94a941a5044e26de946c1100d652dfe46


--
nosy: +miss-islington

___
Python tracker 

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



[issue33989] ms.key_compare is not initialized in all pathes of list_sort_impl

2018-06-28 Thread Pochang Chen


New submission from Pochang Chen :

Relevant code (Objects/listobject.c lines 2268 -- 2286 as of commit e76ac9d):

/* Choose the best compare, given what we now know about the keys. */
if (keys_are_all_same_type) {

if (key_type == _Type && strings_are_latin) {
ms.key_compare = unsafe_latin_compare;
}
else if (key_type == _Type && ints_are_bounded) {
ms.key_compare = unsafe_long_compare;
}
else if (key_type == _Type) {
ms.key_compare = unsafe_float_compare;
}
else if ((ms.key_richcompare = key_type->tp_richcompare) != NULL) {
ms.key_compare = unsafe_object_compare;
}
}
else {
ms.key_compare = safe_object_compare;
}

Clearly, ms.key_compare is not assigned here if keys_are_all_same_type is true 
but key_type->tp_richcompare is NULL.

I don't know how to obtain an object with ob_type->tp_richcompare being NULL, 
though.

--
components: Interpreter Core
messages: 320679
nosy: johnchen902
priority: normal
severity: normal
status: open
title: ms.key_compare is not initialized in all pathes of list_sort_impl
type: crash
versions: 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



[issue33985] ContextVar does not have a "name" attribute

2018-06-28 Thread miss-islington


miss-islington  added the comment:


New changeset 4c20d2bf5d174260558c71052b73d73b6c34 by Miss Islington (bot) 
in branch '3.7':
bpo-33985: Implement ContextVar.name attribute. (GH-7980)
https://github.com/python/cpython/commit/4c20d2bf5d174260558c71052b73d73b6c34


--
nosy: +miss-islington

___
Python tracker 

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



[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2018-06-28 Thread Eryk Sun


Change by Eryk Sun :


--
stage: needs patch -> patch review
versions: +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



Re: overlooked patch?

2018-06-28 Thread Terry Reedy
Yep.  We do not have enough people reviewing patches.  Perhaps you could 
do so with this one.


On 6/28/2018 12:02 PM, Marco Prosperi wrote:

hello, just to give evidence that there is a bug in python 3.6/3.7 for
which there is a patch prepared a long time ago but probably it has never
been applied because the status/stage of the bug is 'needs patch'.


This is really a secondary issue but I changed it, and requested a review.


https://bugs.python.org/issue29097



--
Terry Jan Reedy

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


[issue33985] ContextVar does not have a "name" attribute

2018-06-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7605

___
Python tracker 

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



[issue33985] ContextVar does not have a "name" attribute

2018-06-28 Thread Yury Selivanov


Change by Yury Selivanov :


--
priority: release blocker -> high

___
Python tracker 

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



[issue33985] ContextVar does not have a "name" attribute

2018-06-28 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset 41cb0baea96a80360971908a0bd79d9d40dd5e44 by Yury Selivanov in 
branch 'master':
bpo-33985: Implement ContextVar.name attribute. (GH-7980)
https://github.com/python/cpython/commit/41cb0baea96a80360971908a0bd79d9d40dd5e44


--

___
Python tracker 

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



I lost nearly all my modules installing 3.7

2018-06-28 Thread Elliott Roper
I have done something stupid. Don't know what.

My $PATH looks like this
XXXMac:~ elliott$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Pyth
on.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.
5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/elliott/bin
:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/git/bin

pip3 list or pip3.7 list gives me
Package Version
-- ---
pip 10.0.1
setuptools 39.0.1
> > > import numpy as np
Traceback (most recent call last):
File "", line 1, in 
ModuleNotFoundError: No module named 'numpy'
So it is not lying to me!!!

pip list or pip3.6 list
gives the whole caboodle I was expecting with a far smaller version number 
for setuptools.

My understanding is that the whole $PATH is searched in order to resolve an 
import, but it isn't.

It might be relevant that I have had a bit of hassle installing module 
updates in the past. I would get an error saying the module version being 
replaced could not be deleted with permissions errors which I resolved with a 
bit of sudo -H.

Python 3.6 is still working properly when invoked explicitly

-- 
To de-mung my e-mail address:- fsnospam$elliott$$ PGP Fingerprint: 1A96 3CF7 
637F 896B C810 E199 7E5C A9E4 8E59 E248

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


[issue27500] ProactorEventLoop cannot open connection to ::1

2018-06-28 Thread Yury Selivanov


Yury Selivanov  added the comment:

> Somebody please submit a PR so this can be fixed in 3.7.1 and the fix can
> be backported to 3.6.7.

Somehow I overlooked this one when I was sifting the issues we needed to fix in 
3.7.  I've opened a PR.

--
priority: normal -> high

___
Python tracker 

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



[issue27500] ProactorEventLoop cannot open connection to ::1

2018-06-28 Thread Yury Selivanov


Change by Yury Selivanov :


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

___
Python tracker 

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



[issue28411] Eliminate PyInterpreterState.modules.

2018-06-28 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +7603

___
Python tracker 

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



[issue27500] ProactorEventLoop cannot open connection to ::1

2018-06-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

Somebody please submit a PR so this can be fixed in 3.7.1 and the fix can
be backported to 3.6.7.

--

___
Python tracker 

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



Re: Should nested classes in an Enum be Enum members?

2018-06-28 Thread Ian Kelly
On Thu, Jun 28, 2018 at 4:38 AM Ben Finney  wrote:
>
> Ethan Furman  writes:
>
> > Consider the following Enum definition:
> >
> >   class Color(Enum):
> >   RED = 1
> >   GREEN = 2
> >   BLUE = 3
> >   @property
> >   def lower(self):
> >   return self.name.lower()
> >   def spam(self):
> >   return "I like %s eggs and spam!" % self.lower
> >   class SomeClass:
> >   pass
>
> That dumbfounds my intuitions.
>
> Specifically, I can't make sense of why someone would want to have a
> class that is simultaneously behaving as an enumerated type, *and* has
> an API of custom callable attributes.

You don't see value in enum members having properties?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2018-06-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7602

___
Python tracker 

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



[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2018-06-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7601

___
Python tracker 

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



[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2018-06-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset 9b9d58f0d88b338eb8d2ae0da5cd91d60d1b0e39 by Steve Dower (Thomas A 
Caswell) in branch 'master':
bpo-31546: Fix input hook integration (GH-7978)
https://github.com/python/cpython/commit/9b9d58f0d88b338eb8d2ae0da5cd91d60d1b0e39


--

___
Python tracker 

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



overlooked patch?

2018-06-28 Thread Marco Prosperi
hello, just to give evidence that there is a bug in python 3.6/3.7 for
which there is a patch prepared a long time ago but probably it has never
been applied because the status/stage of the bug is 'needs patch'.

https://bugs.python.org/issue29097

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


[issue32996] Improve What's New in 3.7

2018-06-28 Thread miss-islington


miss-islington  added the comment:


New changeset 48dc7527e32512a27a58107477926719ea4c589b by Miss Islington (bot) 
in branch '3.7':
bpo-32996: Enhancements to What's New based on feedback (GH-7988)
https://github.com/python/cpython/commit/48dc7527e32512a27a58107477926719ea4c589b


--

___
Python tracker 

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



[issue32996] Improve What's New in 3.7

2018-06-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7600

___
Python tracker 

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



[issue32996] Improve What's New in 3.7

2018-06-28 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset 4d26c8a177d8ada440b3cfdfb1d0423ab5ca81a7 by Yury Selivanov (Elvis 
Pranskevichus) in branch 'master':
bpo-32996: Enhancements to What's New based on feedback (GH-7988)
https://github.com/python/cpython/commit/4d26c8a177d8ada440b3cfdfb1d0423ab5ca81a7


--

___
Python tracker 

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



[issue32996] Improve What's New in 3.7

2018-06-28 Thread Elvis Pranskevichus


Change by Elvis Pranskevichus :


--
pull_requests: +7599

___
Python tracker 

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



[issue33963] IDLE macosx: add tests.

2018-06-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Mark Roseman emailed me that moving the 3 imports within overrideRootMenu to 
the top of the module does not appear to cause a problem.

--

___
Python tracker 

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



Re: Should nested classes in an Enum be Enum members?

2018-06-28 Thread Ethan Furman

On 06/28/2018 01:11 AM, Steven D'Aprano wrote:

On Wed, 27 Jun 2018 07:48:53 -0700, Ethan Furman wrote:


[Note:  there is a similar thread on Python-Ideas, if you would like to
respond there.]

Consider the following Enum definition:

class  Color(Enum):
RED = 1
GREEN = 2
BLUE = 3
@property
def lower(self):
return self.name.lower()
def spam(self):
return "I like %s eggs and spam!" % self.lower
class SomeClass:
pass

Which of the above Color attributes are enums, and which aren't?



(In hindsight perhaps you should have called the class EnumType so that
ambiguity would not exist. Then an enum would *always* refer to the
members Color.RED etc, and never to Color itself.)


The problem then is the ambiguity between EnumMeta and EnumType.  :/


Answer:

- RED, GREEN, and BLUE are members
- lower and spam() are not
- SomeClass /is/ a member (but not its instances)


Is that by accident or by design?


By design.  It is entirely possible to want an enum of types (int, float, str, 
etc.).



Question:

Should `SomeClass` be an enum member?  When would it be useful to
have an embedded class in an Enum be an enum member?


I honestly cannot think of any reason to nest a class inside of an Enum
class. But if I did, I would probably want it to be just a regular class,
and not an enum member.

If I wanted to nest an Enum class inside an Enum class (but why???) I'd
just inherit from Enum:

class Colour(Enum):
 class PrimaryColour(Enum):
 RED = 1
 GREEN = 2
 BLUE = 3
 OCTARINE = 8
 class SecondaryColour(Enum):
 PUCE = 101
 MAUVE = 102
 BEIGE = 103
 TEAL = 104


This really seems to be the sticking point -- what should an Enum of Enums look 
like?  For example, should the above do

  --> list(Colour)
  [Colour.PrimaryColour <...>, Colour.SecondaryColour <...>]

or something else?


The only example I have seen so far of nested classes in an Enum is when
folks want to make an Enum of Enums, and the nested Enum should not
itself be an enum member.  Since the counter-example already works I
haven't seen any requests for it.  ;)

So I'm asking the community:  What real-world examples can you offer for
either behavior?  Cases where nested classes should be enum members, and
cases where nested classes should not be members.


Is this a trick question?


Heh.  Not at all.  It is entirely possible to have a real use-case which we 
cannot model the way we want in code.

--
~Ethan~

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


[issue6761] Class calling

2018-06-28 Thread Andrés Delfino

Andrés Delfino  added the comment:

The PR uses a slight rewording of David's phrasing.

--
nosy: +adelfino
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



[issue6761] Class calling

2018-06-28 Thread Andrés Delfino

Change by Andrés Delfino :


--
keywords: +patch
pull_requests: +7598
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



[issue33954] float.__format__('n') fails with _PyUnicode_CheckConsistency assertion error

2018-06-28 Thread STINNER Victor


STINNER Victor  added the comment:

> The bug is in _PyUnicode_InsertThousandsGrouping()

This function should take a _PyUnicodeWriter as input, not a PyUnicodeObject.

--

___
Python tracker 

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



[OT] Why are BBSes? [was Where's the junk coming from?]

2018-06-28 Thread Grant Edwards
On 2018-06-28, Kerr Avon  wrote:

> Yep confirming I found the issue lay with the sysop of a BBS that connects 
> to the gateway linked to news.bbs.nz

OK, I've got to ask...

Why are there still BBSes?

Who even has a modem these days?  [OK, I'll admit my 11 year old
Thinkpad T500 has a built-in POTS modem, but it's never been used.]

-- 
Grant Edwards   grant.b.edwardsYow! Vote for ME -- I'm
  at   well-tapered, half-cocked,
  gmail.comill-conceived and
   TAX-DEFERRED!

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


Re: configparser v/s file variables

2018-06-28 Thread Grant Edwards
On 2018-06-28, Steven D'Aprano  wrote:

> So why give them the ability to escalate their privilege to that of
> your application (which probably can do lots of things they can't
> do) by directly executing Python code they supply?

To be fair, that situation isn't common.  The vast majority of
applications run with the exact same set of privledges as the user who
invoked them.  At least that's the case on Linux/Unix. Perhaps Windows
apps are different and the usual case is for many applications to have
dangerous capabilities that an average user who's invoking them
shouldn't have.  That sounds stupid enough to be something that would
be normal for Windows.

I still maintain it's a bad idea to run arbitrary code found in
user-edited config files.

There may be cases where somebody has figured out how to muck with a
config file that's shared among multiple users, or has tricked
somebody into including something from an untrusted source in an
include file.

Or there could be users who don't know what they're doing and
unwittingly type something harmful into a config file:

  bad_command = os.system("rm -rf ~/*")

Yes, I know, users would never be that dumb...

-- 
Grant Edwards   grant.b.edwardsYow! Everybody gets free
  at   BORSCHT!
  gmail.com

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


[issue33954] float.__format__('n') fails with _PyUnicode_CheckConsistency assertion error

2018-06-28 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +eric.smith, mark.dickinson

___
Python tracker 

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



[issue32545] Unable to install Python 3.7.0a4 on Windows 10 - Error 0x80070643: Failed to install MSI package.

2018-06-28 Thread Amin Radjabov


Amin Radjabov  added the comment:

I have same issue on Win 7 x64

--
nosy: +Amin Radjabov

___
Python tracker 

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



[issue33932] Calling Py_Initialize() twice now triggers a fatal error (Python 3.7)

2018-06-28 Thread Miro Hrončok

Change by Miro Hrončok :


--
nosy: +hroncok

___
Python tracker 

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



Re: Something new which all programmers world wide will appreciate

2018-06-28 Thread Gene Heskett
On Thursday 28 June 2018 06:35:13 Alister via Python-list wrote:

> On Wed, 27 Jun 2018 14:30:15 -0700, Rob Gaddi wrote:
> > On 06/27/2018 02:14 PM, skybuck2...@hotmail.com wrote:
> >> Now I don't like the French much ! LOL.
> >>
> >> But this time they have invented something which will fill
> >> programmers with tears of joy ! =D
> >>
> >> http://www.euronews.com/2018/06/27/pizza-making-robot
> >>
> >> Hopefully this will lead to cheaper and delicious pizzas in the
> >> future ! ;) =D
> >>
> >> Bye,
> >>Skybuck.
> >
> > Or, you know, someone didn't bother putting limit checks in and a
> > time out of 20 the thing gets lost and starts putting the sauce
> > directly on the customer.
>
> as a diabetic the bread base puts them firmly on the bad list anyway
> :-(
>
+1 at least, from another DM-II.
>
> --
> "If it ain't broke, don't fix it."
> - Bert Lantz



-- 
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33932] Calling Py_Initialize() twice now triggers a fatal error (Python 3.7)

2018-06-28 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, now with my regression hat.

In Python 3.6, Py_Main() calls Py_Initialize(). If Py_Initialize() is called 
twice, the second call does nothing. So it's fine to call Py_Main() after 
Py_Initialize() in Python 3.6.

--

___
Python tracker 

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



[issue33932] Calling Py_Initialize() twice now triggers a fatal error (Python 3.7)

2018-06-28 Thread STINNER Victor


STINNER Victor  added the comment:

I looked quickly at _Py_InitializeCore() and I'm not sure that it's designed to 
replace an existing configuration.

Example:

int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */

(...)

if (!core_config->use_hash_seed || core_config->hash_seed) {
/* Random or non-zero hash seed */
Py_HashRandomizationFlag = 1;
}

If Py_Initialize() sets Py_HashRandomizationFlag to 1, but Py_Main() doesn't 
use an hash seed, Py_HashRandomizationFlag value remains 1 which is wrong.

pymain_read_conf() fills _PyCoreConfig from global configuration flags, but 
then global configuration flags are supposed to be set from the global 
configuration flags.

So maybe for this specific case, _Py_InitializeCore() should always set 
Py_HashRandomizationFlag. But it was just one example to show that right now, 
_Py_InitializeCore() doesn't seem to support to be called twice with two 
different configurations.

--

___
Python tracker 

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



[issue33932] Calling Py_Initialize() twice now triggers a fatal error (Python 3.7)

2018-06-28 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue because fontforge still fails on Python 3.7.0 final. 
fontforge calls Py_Initialize() and then calls Py_Main() which fails with an 
assertion: https://bugzilla.redhat.com/show_bug.cgi?id=1595421

The same code works well on Python 3.6, so should we define this issue as a 
regression?

Call stack:

* Py_Main()
* pymain_main()
* _Py_InitializeCore() which fails

The problem is that the first call of Py_Initialize() sets a first 
configuration, but then Py_Main() sets a different configuration.

Is it correct to call Py_Initialize() before Py_Main()?

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue33983] unify types for lib2to3.pytree.Base.children

2018-06-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Empty list takes more memory and more time for creating than an empty tuple 
(the latter is just a singleton). Since all Node and Leaf instances share the 
same children by default, making it a list is errorprone.

What is the problem of having an empty tuple instead of an empty list?

--
nosy: +benjamin.peterson, serhiy.storchaka

___
Python tracker 

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



Re: Error Launching python 3.7.0

2018-06-28 Thread Mark Lawrence

On 28/06/18 10:14, ojas gupta wrote:

  I just downloaded and installed python 3.7.0 on my PC and whenever I tried
to launch the application it showed "error" saying python runtime dll
missing... and that too is happening despite i downloaded the official
licenced product from python.org 

I am attaching a photo clicked by me when that error message displayed so
that you can have a better idea of my issue...

Thank you in advance...



The photo has been stripped as this is a text only list.  However I'll 
guess that this has been asked and answered repeatedly before, so see 
e.g. 
https://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/python-360-cant-start-because-api-ms-win-crt/a58999ec-a94e-44ad-8f92-8136ce98871b


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


  1   2   >