-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
ENH: Added mmapmodule.c to Allow mmap objects to access the madvise() system call #13184
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
Conversation
|
||
#ifdef MS_WINDOWS | ||
#include <windows.h> | ||
static int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank line before.
Lots of style nits, more than I commented on. Take a look at |
/ and further modified by a-deeb | ||
*/ | ||
|
||
#define PY_SSIZE_T_CLEAN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this placement safe?
Can't we add just the madvise function, rather than cloning a builtin module? |
Yeah, if we put this in for madvise, then we should limit it to the single feature we actually need. EDIT: Sorry to add it later, the original issue has some ctypes solution. Now we may need to do something more portable and could possibly hide it away in C, but I think that solution seemed about right for a minimal approach. |
numpy/core/src/common/mmapmodule.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the license of this file? Having author and contributor attribution with no copyright release is IMO problematic, but I am not a lawyer. Where did it come from? Also, do we allow github names as contributors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a complete copy of the one in cpython
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original header in cpython is different. If it is copied from there it I think it should at least maintain the original header, probably with the addition of this sentence from the CPython LICENSE "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation; All Rights Reserved". Looking around at other files in the repo, that would seem to be enough.
yes, it is from CPython , I will find out what the license of this file is |
* DOC: fix mistatement in numpy.pad docstring
Switch from python-style kwarg signature to style used for all other functions
Hi everyone, I would like to know if there is anything else I could do on this file regarding this issue, let me know, I'm really excited about helping out 😄 |
@a-deeb well, we did comment above that this should be a minimal port of functionality. We do not need to copy paste all of the memorymap implementation from cpython probably? So to move this along, would it be possible to steal only the parts that we would actually have to put into numpy? |
@seberg so I should just have the mmap_madvise_method() along with any of its dependent structs and methods and remove everything else? I'll get working that, Thanks again! |
I'm not really sure this approach is worth pursuing - it might be best just to wait for the upstream support, and to point users to the Alternatively, we could include the ctypes solution directly into |
@a-deeb sorry, but I do not think we will be merging this with the whole of |
@a-deeb thanks for the PR, but I will close this for now. Would be happy about a PR implementing a more minimal approach to exposing this in |
Adding python/cpython#6172 Allow mmap objects to access the madvise() system call , based on @seberg recommendation ,and adding it numpy separately based on issue #13172
I added the
mmapmodule.c
module in the numpy/numpy/core/src/common/ directory