Skip to content

Commit 4f29801

Browse files
committed
Clarify nested UCS2/4 PY2/3 directives
Clearly shows what each section does
1 parent 5357401 commit 4f29801

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/runtime/runtime.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,8 +1590,7 @@ internal static bool PyUnicode_Check(IntPtr ob)
15901590
return PyObject_TYPE(ob) == Runtime.PyUnicodeType;
15911591
}
15921592

1593-
#if (UCS2)
1594-
#if (PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36)
1593+
#if UCS2 && PYTHON3
15951594
[DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,
15961595
ExactSpelling=true, CharSet=CharSet.Unicode)]
15971596
internal unsafe static extern IntPtr
@@ -1633,8 +1632,7 @@ internal unsafe static extern IntPtr
16331632
ExactSpelling = true, CharSet = CharSet.Unicode)]
16341633
internal unsafe static extern IntPtr
16351634
PyUnicode_FromOrdinal(int c);
1636-
1637-
#else
1635+
#elif UCS2 && PYTHON2
16381636
[DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,
16391637
EntryPoint="PyUnicodeUCS2_FromObject",
16401638
ExactSpelling=true, CharSet=CharSet.Unicode)]
@@ -1676,10 +1674,7 @@ internal unsafe static extern IntPtr
16761674
ExactSpelling=true, CharSet=CharSet.Unicode)]
16771675
internal unsafe static extern IntPtr
16781676
PyUnicode_FromOrdinal(int c);
1679-
#endif
1680-
#endif
1681-
#if (UCS4)
1682-
#if (PYTHON33 || PYTHON34 || PYTHON35 || PYTHON36)
1677+
#elif UCS4 && PYTHON3
16831678
[DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl,
16841679
ExactSpelling=true, CharSet=CharSet.Unicode)]
16851680
internal unsafe static extern IntPtr
@@ -1723,8 +1718,7 @@ internal unsafe static extern IntPtr
17231718
ExactSpelling = true, CharSet = CharSet.Unicode)]
17241719
internal unsafe static extern IntPtr
17251720
PyUnicode_FromOrdinal(int c);
1726-
1727-
#else
1721+
#elif UCS4 && PYTHON2
17281722
[DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl,
17291723
EntryPoint = "PyUnicodeUCS4_FromObject",
17301724
ExactSpelling = true, CharSet = CharSet.Unicode)]
@@ -1768,8 +1762,6 @@ internal unsafe static extern IntPtr
17681762
ExactSpelling = true, CharSet = CharSet.Unicode)]
17691763
internal unsafe static extern IntPtr
17701764
PyUnicode_FromOrdinal(int c);
1771-
1772-
#endif
17731765
#endif
17741766

17751767
internal static IntPtr PyUnicode_FromString(string s)

0 commit comments

Comments
 (0)