Skip to content

Commit aaaff76

Browse files
committed
memory.make_object() now allows not only Pointer instances
Objects on which you can call get_object_pointer() are allowed as well. Removed a few redundant imports
1 parent bb8300c commit aaaff76

5 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/core/modules/memory/memory_function_info.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ template<> struct MFI_Impl<4*SH_PTRSIZE> // THE BIGGEST ONE!!!1GABEN
315315
// ============================================================================
316316
#include "memory_signature.h"
317317
#include "memory_calling_convention.h"
318-
#include "memory_tools.h"
319318

320319
#include "boost/python/signature.hpp"
321320
#include "boost/mpl/transform.hpp"

src/core/modules/memory/memory_hooks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
// >> INCLUDES
2929
// ============================================================================
3030
#include "memory_hooks.h"
31-
#include "memory_tools.h"
31+
#include "memory_pointer.h"
3232
#include "utilities/wrap_macros.h"
3333
#include "utilities/call_python.h"
3434
#include "utilities/sp_util.h"

src/core/modules/memory/memory_scanner.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "dynload.h"
4040

4141
#include "memory_scanner.h"
42-
#include "memory_tools.h"
4342
#include "utilities/sp_util.h"
4443
#include "utilities/call_python.h"
4544
#include "sp_main.h"

src/core/modules/memory/memory_scanner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
//-----------------------------------------------------------------------------
3333
#include <list>
3434
#include "export_main.h"
35-
#include "memory_tools.h"
35+
#include "memory_pointer.h"
3636

3737
struct Signature_t
3838
{

src/core/modules/memory/memory_tools.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include "memory_pointer.h"
3434
#include "memory_utilities.h"
3535

36+
CPointer* ExtractPointer(object oPtr);
37+
3638

3739
// ============================================================================
3840
// >> GetObjectPointer
@@ -49,15 +51,16 @@ inline object GetObjectPointer(object obj)
4951
// ============================================================================
5052
// >> MakeObject
5153
// ============================================================================
52-
inline object MakeObject(object cls, CPointer* pPtr)
54+
inline object MakeObject(object cls, object oPtr)
5355
{
5456
if (!PyObject_HasAttrString(cls.ptr(), GET_OBJ_NAME))
5557
BOOST_RAISE_EXCEPTION(PyExc_ValueError, "Unable to make an object using this class.");
5658

59+
CPointer* pPtr = ExtractPointer(oPtr);
5760
if (!pPtr->IsValid())
5861
BOOST_RAISE_EXCEPTION(PyExc_ValueError, "Pointer is NULL.");
5962

60-
return cls.attr(GET_OBJ_NAME)(ptr(pPtr));
63+
return cls.attr(GET_OBJ_NAME)(pPtr);
6164
}
6265

6366

0 commit comments

Comments
 (0)