8000 Pypy fixes by mattip · Pull Request #7839 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Pypy fixes #7839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions numpy/core/src/multiarray/scalartypes.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -4080,6 +4080,7 @@ initialize_numeric_types(void)
/*
* need to add dummy versions with filled-in nb_index
* in-order for PyType_Ready to fill in .__index__() method
* also fill array_type_as_number struct with reasonable defaults
*/

/**begin repeat
Expand All @@ -4088,6 +4089,7 @@ initialize_numeric_types(void)
* #NAME = Byte, Short, Int, Long, LongLong, UByte, UShort,
* UInt, ULong, ULongLong#
*/
@name@_arrtype_as_number = gentype_as_number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my phone so haven't looked at the context here, but do I infer correctly from the commit message that this is just filling in some arbitrary pointer here that will be overwritten later? If so then there should be a comment to that effect here, because otherwise to a naive reader it looks like there's some actual reason why gentype_as_number wil 8000 l work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On 15/07/16 09:16, Nathaniel J. Smith wrote:

In numpy/core/src/multiarray/scalartypes.c.src
#7839 (comment):

@@ -4088,6 +4088,7 @@ initialize_numeric_types(void)
* #NAME = Byte, Short, Int, Long, LongLong, UByte, UShort,
* UInt, ULong, ULongLong#
*/

  • @name@_arrtype_as_number = gentype_as_number;

On my phone so haven't looked at the context here, but do I infer
correctly from the commit message that this is just filling in some
arbitrary pointer here that will be overwritten later? If so then
there should be a comment to that effect here, because otherwise to a
naive reader it looks like there's some actual reason why
gentype_as_number will work.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/numpy/numpy/pull/7839/files/a4087dad3b1f1c7dcfb9db33dd8ff53612ec468a#r70979857,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAySZ4-nEEUPH1vCV3_KCtn2fQ4ZDGnwks5qV5Y_gaJpZM4JNa6j.

It is not arbitrary, the pointer is from the base class, i.e. until the
NULL functions are overloaded, the gentype functions be called.
So indeed, they will work and are exactly the functions called until
overloaded.
Note later in the same function, tp_richcompare is likewise set to
gentype_richcompare.

Matti

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI as a rule of thumb, when replying to github messages from your email client then you're best off top-posting, because github's email parser is kinda terrible. (See the github post that this is replying to for an example.)

Py@NAME@ArrType_Type.tp_as_number = &@name@_arrtype_as_number;
Py@NAME@ArrType_Type.tp_as_number->nb_index = (unaryfunc)@name@_index;

Expand Down
9 changes: 7 additions & 2 deletions numpy/distutils/fcompiler/gnu.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@ def get_flags_linker_so(self):
# from it.
import distutils.sysconfig as sc
g = {}
filename = sc.get_makefile_filename()
sc.parse_makefile(filename, g)
try:
get_makefile_filename = sc.get_makefile_filename
except AttributeError:
pass # i.e. PyPy
else:
filename = get_makefile_filename()
sc.parse_makefile(filename, g)
target = g.get('MACOSX_DEPLOYMENT_TARGET', '10.3')
os.environ['MACOSX_DEPLOYMENT_TARGET'] = target
if target == '10.3':
Expand Down
0