Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Start to implement PyType_FromSpec type approach#1196

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
koubaa wants to merge13 commits intopythonnet:masterfromkoubaa:pyspec-types
Closed
Changes from1 commit
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
PrevPrevious commit
NextNext commit
change CreateType
  • Loading branch information
@koubaa
koubaa committedAug 1, 2020
commit44d364e90f7cc65d50d579abb66a69df5e57bfdc
14 changes: 7 additions & 7 deletionssrc/runtime/typemanager.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,7 +81,8 @@ internal static IntPtr GetTypeHandle(ManagedType obj, Type type)
/// </summary>
internal static IntPtr CreateType(Type impl)
{
IntPtr type = AllocateTypeObject(impl.Name);
var slotArray = CreateSlotArray(impl);
IntPtr type = AllocateTypeObject(impl.Name, slotArray);
int ob_size = ObjectOffset.Size(type);

// Set tp_basicsize to the size of our managed instance objects.
Expand All@@ -90,13 +91,13 @@ internal static IntPtr CreateType(Type impl)
var offset = (IntPtr)ObjectOffset.TypeDictOffset(type);
Marshal.WriteIntPtr(type, TypeOffset.tp_dictoffset, offset);

InitializeSlots(type, impl);
//InitializeSlots(type, impl);

int flags = TypeFlags.Default | TypeFlags.Managed |
TypeFlags.HeapType | TypeFlags.HaveGC;
Util.WriteCLong(type, TypeOffset.tp_flags, flags);

Runtime.PyType_Ready(type);
//Runtime.PyType_Ready(type);

IntPtr dict = Marshal.ReadIntPtr(type, TypeOffset.tp_dict);
IntPtr mod = Runtime.PyString_FromString("CLR");
Expand DownExpand Up@@ -883,11 +884,10 @@ internal static void InitializeNativeCodePage()
#endregion

/// <summary>
/// Given a newly allocated Python type object and a managed Type that
/// provides the implementation for the type, connect the type slots of
/// the Python object to the managed methods of the implementing Type.
/// Given a managed Type that provides the implementation for the type,
/// create a PY_TYPE_SLOT array to be used for PyType_FromSpec.
/// </summary>
internal PY_TYPE_SLOT[]InitializeSlots(Type impl)
internalstaticPY_TYPE_SLOT[]CreateSlotArray(Type impl)
{
// We work from the most-derived class up; make sure to get
// the most-derived slot and not to override it with a base
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp