[issue19692] Rename Py_SAFE_DOWNCAST

2019-09-14 Thread hai shi


hai shi  added the comment:

Looks we have a fast version rhythm. IMHO, If user would be affected and 
reported, reversing the PR is ok.

--

___
Python tracker 

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



[issue19692] Rename Py_SAFE_DOWNCAST

2019-08-10 Thread Sanyam Khurana


Change by Sanyam Khurana :


--
nosy: +CuriousLearner
versions: +Python 3.7, Python 3.8, Python 3.9 -Python 3.4

___
Python tracker 

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



[issue19692] Rename Py_SAFE_DOWNCAST

2019-08-05 Thread hai shi


hai shi  added the comment:

It's a big problem, no ability to answer this question :(

--

___
Python tracker 

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



[issue19692] Rename Py_SAFE_DOWNCAST

2019-08-05 Thread Inada Naoki


Inada Naoki  added the comment:

While Py_SAFE_DOWNCAST is not documented, it doesn't start with underscore.
How many 3rd party code are broken by changing the name?

--
nosy: +inada.naoki

___
Python tracker 

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



[issue19692] Rename Py_SAFE_DOWNCAST

2019-08-03 Thread STINNER Victor


STINNER Victor  added the comment:

I dislike this macro. A cast is either safe or unsafe. If it is safe, (type)var 
would be better. If it is unsafe, well, it would be better to add a runtime 
check. No? (I mean better error reporting than abort() pnly in debug mode.)

--

___
Python tracker 

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



[issue19692] Rename Py_SAFE_DOWNCAST

2019-08-03 Thread Stefan Krah


Stefan Krah  added the comment:

Why would one not abort() in release mode? If the cast is inexact, the results 
will usually be so wrong that even on a web server a hard exit is preferable.

I don't think the check costs much time with branch prediction.

--
nosy: +skrah

___
Python tracker 

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



[issue19692] Rename Py_SAFE_DOWNCAST

2019-08-03 Thread hai shi


hai shi  added the comment:

Rename Py_SAFE_DOWNCAST in PR_15090.

In the C API: Py_TRASHCAN_SAFE_BEGIN and Py_TRASHCAN_SAFE_END should be removed 
or keep it due to compatibility?

In the stdlib: Looks that it's not changed is ok.

--
nosy: +shihai1991

___
Python tracker 

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



[issue19692] Rename Py_SAFE_DOWNCAST

2019-08-03 Thread hai shi


Change by hai shi :


--
keywords: +patch
pull_requests: +14835
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15090

___
Python tracker 

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



[issue19692] Rename Py_SAFE_DOWNCAST

2013-11-22 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Py_SAFE_DOWNCAST's name is a bit misleading: it isn't safe except in debug 
mode. I propose to rename it to Py_DOWNCAST, so that developers are reminded 
that the burden of the sanity checks is on them.

--
components: Interpreter Core
messages: 203764
nosy: christian.heimes, haypo, pitrou, tim.peters
priority: normal
severity: normal
status: open
title: Rename Py_SAFE_DOWNCAST
type: enhancement
versions: Python 3.4

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



[issue19692] Rename Py_SAFE_DOWNCAST

2013-11-22 Thread Christian Heimes

Christian Heimes added the comment:

+1

--

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



[issue19692] Rename Py_SAFE_DOWNCAST

2013-11-22 Thread STINNER Victor

STINNER Victor added the comment:

I like Py_DOWNCAST name.

--

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



[issue19692] Rename Py_SAFE_DOWNCAST

2013-11-22 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Actually, _Py_DOWNCAST may be better (not a public API).

--

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



[issue19692] Rename Py_SAFE_DOWNCAST

2013-11-22 Thread Martin v . Löwis

Martin v. Löwis added the comment:

-1. The macro name doesn't claim the cast to be safe, i.e. it's not 
Py_SAFELY_DOWNCAST, but safe downcast, i.e. it's an assertion that the cast 
actually has been verified as being safe.

--
nosy: +loewis

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



[issue19692] Rename Py_SAFE_DOWNCAST

2013-11-22 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 -1. The macro name doesn't claim the cast to be safe, i.e. it's not
 Py_SAFELY_DOWNCAST, but safe downcast, i.e. it's an assertion that
 the cast actually has been verified as being safe.

It's not an assertion, it's a cast.
Otherwise it should be named Py_ASSERT_SAFE_DOWNCAST (and it should only
do the assertion, not the cast).

--

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



[issue19692] Rename Py_SAFE_DOWNCAST

2013-11-22 Thread Tim Peters

Tim Peters added the comment:

Goodness.  Name it

_Py_DOWNCAST_AND_IN_DEBUG_MODE_ASSERT_UPCASTING_THE_RESULT_COMPARES_EQUAL_TO_THE_ORIGINAL_ARGUMENT

;-)

--

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



[issue19692] Rename Py_SAFE_DOWNCAST

2013-11-22 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Well, I obviously won't fight very hard for this one.

But I would like to point out that APIs with safe (not safely :-)) in their 
name usually imply that the API is safe, not that the input has been sanitized 
beforehand.

For example in the stdlib: pprint.saferepr, string.safe_substitute, 
xmlrpc.client.SafeTransport. In the C API: Py_TRASHCAN_SAFE_BEGIN.

--

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