| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| PyImport_GetModuleDict(); | ||
|
|
||
|
|
||
| #if !(PYTHON26 || PYTHON27) |
There was a problem hiding this comment.
Can this be #if PYTHON3 ?
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, I'll change it.
Sorry, something went wrong.
|
Yes, it's an alternative using directly the Python API function. |
Sorry, something went wrong.
| using (new PythonEngine()) | ||
| using (var argv = new PyList(Runtime.Runtime.PySys_GetObject("argv"))) | ||
| { | ||
| Assert.That(argv.Length() != 0); |
There was a problem hiding this comment.
first need to check that it is not null
Sorry, something went wrong.
There was a problem hiding this comment.
Why? If it is null, this will fail with a NullReferenceException, perfectly fine. This PR is supposed to ensure that sys.argv is always initialised.
Sorry, something went wrong.
| <Optimize>false</Optimize> | ||
| <DebugType>full</DebugType> | ||
| <PlatformTarget>x64</PlatformTarget> | ||
| <DefineConstants>TRACE;DEBUG;PYTHON3;PYTHON35;UCS2</DefineConstants> |
There was a problem hiding this comment.
this gets overwritten by setup.py or specific needs of the user, so no need to update this
Sorry, something went wrong.
There was a problem hiding this comment.
He probably added that during his development and forgot to remove it.
Sorry, something went wrong.
There was a problem hiding this comment.
Updated #346 to include configuration for PY3 development.
Sorry, something went wrong.
There was a problem hiding this comment.
Yep, exactly that, I'll remove this line.
Sorry, something went wrong.
|
I'm OK with merging this version as long as comments are addressed |
Sorry, something went wrong.
Checks whether an error occurred and in case it has throws a PythonException.
In particular in Py.Import.
Codecov Report@@ Coverage Diff @@
## master #347 +/- ##
==========================================
- Coverage 61.45% 61.37% -0.08%
==========================================
Files 61 61
Lines 5336 5369 +33
Branches 900 896 -4
==========================================
+ Hits 3279 3295 +16
- Misses 1819 1853 +34
+ Partials 238 221 -17
Continue to review full report at Codecov.
|
Sorry, something went wrong.
|
@filmor the coverage on pythonengine.cs reduced |
Sorry, something went wrong.
|
It's probably the refactoring he did. The coverage needs some fine tuning, its definetly not as robust as python's coverage engine. |
Sorry, something went wrong.
| int size = name + ascii.Length + 1; | ||
| IntPtr ptr = Marshal.AllocHGlobal(size); | ||
| for (int i = 0; i <= m_free; i += IntPtr.Size) | ||
| for (int i = 0; i < m_free; i += IntPtr.Size) |
There was a problem hiding this comment.
where m_free is set?
Sorry, something went wrong.
| /// This class provides the public interface of the Python runtime. | ||
| /// </summary> | ||
| public class PythonEngine | ||
| public class PythonEngine : IDisposable |
There was a problem hiding this comment.
why is this now IDisposable?
Sorry, something went wrong.
There was a problem hiding this comment.
Because that's easier to use correctly than Initialize and Shutdown.
Sorry, something went wrong.
| { | ||
| throw new PythonException(); | ||
| } | ||
| Py.Throw(); |
There was a problem hiding this comment.
why not also check for IntPtr.Zero?
Sorry, something went wrong.
There was a problem hiding this comment.
Because this function either returns null and sets an exception, or it returns a module.
Sorry, something went wrong.
| { | ||
| Initialize(Enumerable.Empty<string>()); | ||
| } | ||
|
|
Sorry, something went wrong.
There was a problem hiding this comment.
i did not click submit review few weeks ago
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
What does this implement/fix? Explain your changes.
Implements an overload of Initialize and a Py.SetArgv function that allow the user to issue a PySys_SetArgvEx call. By default, this call is done on Initialize with a list that contains a single empty string (['']), using the arguments supplied to the .NET process if available.
Does this close any currently open issues?
#299.
Any other comments?
Based on the fix-shutdown branch as otherwise I'm not able to run the unit-tests reliably..