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

Ensure that sys.argv is set#301

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

Merged
vmuriart merged 2 commits intomasterfromsetsysargv
Feb 8, 2017
Merged

Ensure that sys.argv is set#301

vmuriart merged 2 commits intomasterfromsetsysargv
Feb 8, 2017

Conversation

den-run-ai
Copy link
Contributor

@tonyroberts
Copy link
Contributor

Why not use PySys_SetArgvEx?

filmor, vmuriart, and den-run-ai reacted with thumbs up emoji

@den-run-ai
Copy link
ContributorAuthor

@tonyroberts because it is very simple one-liner and we already have 3 places in pythonengine.cs, where RunString() is used similarly and it is also tested. What is the benefit of using PySys_SetArgvEx, which is not exposed in pythonnet yet?

Anyway we should probably remove PySys_SetArgv in the pythonnet API, because it has security vulnerability due to default updatepath set to 1:

https://docs.python.org/2/c-api/init.html#c.PySys_SetArgvEx

@filmorfilmor changed the titleUpdate runtime.csEnsure that sys.argv is setDec 7, 2016
@filmor
Copy link
Member

filmor commentedDec 7, 2016
edited
Loading

Since this is the initial setup we wouldn't pass inupdatepath = 1. The function pointers aren't available to users anyhow as all of them are marked asinternal.

I'm with@tonyroberts, we should use Python's API directly whenever available. I also don't really agree with the values you're setting here, doesn't it make more sense to

  1. Set them by default to theargv of the .NET application if available
  2. Allow the user to override this by callingPy.SetArgv(someArray)?
vmuriart and den-run-ai reacted with thumbs up emoji

@filmorfilmor mentioned this pull requestJan 9, 2017
9 tasks
@den-run-ai
Copy link
ContributorAuthor

den-run-ai commentedJan 22, 2017
edited
Loading

While writing the tests I realized that with this change now even "import clr" resetssys.argv. Hence need to check in advance ifsys.argv is already set. If not, then set it to list with empty string.

@filmor how would I know .NET applicationsargs frompublic static int Main(string[] args) call without actually being in the scope of this main method? I think this is not available to Python.Runtime.DLL.

@vmuriart
Copy link
Contributor

@denfromufa I got stuck on the same predicament about finding theargs. I think that part should be skipped for now.

@filmor
Copy link
Member

@denfromufaSystem.Environment.GetCommandLineArgs() should do it. But I got stuck with the "reinitialise" issue before, so I didn't finish my alternative PR. Are you suggesting we should skip this for the 2.2.0 release? Let's discuss this over there then.

den-run-ai reacted with thumbs up emoji

Copy link
Contributor

@vmuriartvmuriart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A couple changes on some "extra" files changes.

Otherwise looks good to me. I can push the changes I mentioned above if you ok w that.

.gitignore Outdated
@@ -54,3 +54,4 @@ _UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
/NUnit-3.5.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

**/packages/* should cover this already if you are using the project default version.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

sorry this slipped through - I was not intending to check-in Nunit changes.

GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We don't need another solution. Add the pyproject to thepythonnet.sln instead.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

well, I'm not sure if everyone uses PTVS by default :) How does it look with pyproj in solution, but PTVS not installed? if that's not borken, then I agree that having pyproj in solution is fine!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I can't find any references to it and I forgot I have ptvs instaled too.

Copy link
Contributor

@vmuriartvmuriartJan 23, 2017
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@denfromufa just tried combining to 1 solution and running the solution on a machine withoutptvs. It loaded the solution no problem, it asked me if i wanted to installedptvs to load up the project. I declined, and it just grays out the project and everything else worked fine. It didn't ask me again if i reloaded the solution.

The project file needs to be cleaned up though to sanitize the configurations, otherwise it pollutes the current solution. I'm ok with deleting the solution and leaving thepyproj without adding it to the current solution on thispr.

No issues building in travis, still waiting on appveyor...

den-run-ai reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

good finding, perhaps we should get some help from PTVS MS team for promoting their work :)

@den-run-ai
Copy link
ContributorAuthor

@filmor@vmuriart I'm almost done with this pull request, let me add user facing API and check for System.Environment.GetCommandLineArgs().

vmuriart
vmuriart previously approved these changesJan 23, 2017
@den-run-ai
Copy link
ContributorAuthor

@vmuriart@filmor I added more changes to grab CLR arguments if available (may need some tests). please review. I do not intend to add user facing API at this moment.

@vmuriart
Copy link
Contributor

The more I think about it, the less I like the reading the .net envargs. The behavior might not be what the user expects, and we may be forcing it onto them. I'm ok with thepr with the exception of the very last commit, my gut feeling is that its going to cause headaches.

@vmuriartvmuriart dismissed theirstale reviewJanuary 23, 2017 06:21

re-reviewing

vmuriart
vmuriart previously requested changesJan 23, 2017
Copy link
Contributor

@vmuriartvmuriart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm ok approving without the last commit. We can add it post 2.2.0 release, but I don't want to include it with the release.

This was referencedJan 25, 2017
@filmor
Copy link
Member

Obsoleted by#347.

@filmorfilmor closed thisFeb 1, 2017
@filmorfilmor deleted the setsysargv branchFebruary 1, 2017 09:19
@vmuriart
Copy link
Contributor

@filmor @denfromufa did we want to keep some of the tests?

@den-run-ai
Copy link
ContributorAuthor

@vmuriart does the coverage increase if you add these tests? :)

@filmor
Copy link
Member

Ooh, sorry missed those. Yeah, we should probably add them.

@den-run-ai
Copy link
ContributorAuthor

@filmor can you please reopen this one to add the remaining tests?

I cannot do that because the branch is deleted.

@vmuriartvmuriart restored the setsysargv branchFebruary 7, 2017 02:52
@vmuriart
Copy link
Contributor

@denfromufa I just restored your branch. (or did you mean@filmor's branch from his work)

@den-run-ai
Copy link
ContributorAuthor

OK, let me add the remaining tests, if any. Thanks@vmuriart

@den-run-aiden-run-ai reopened thisFeb 7, 2017
@vmuriart
Copy link
Contributor

might be easiest to create a new branch/pr and copy the tests from this one over to avoid dealing w the merge conflicts and reverting/cleaning other changes.

@codecov
Copy link

codecovbot commentedFeb 8, 2017
edited
Loading

Codecov Report

Merging#301 intomaster willnot impact coverage.

@@           Coverage Diff           @@##           master     #301   +/-   ##=======================================  Coverage   62.72%   62.72%           =======================================  Files          61       61             Lines        5253     5253             Branches      876      876           =======================================  Hits         3295     3295             Misses       1740     1740             Partials      218      218

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update8afd512...2eef75f. Read thecomment docs.

@den-run-aiden-run-ai dismissedvmuriart’sstale reviewFebruary 8, 2017 05:18

please review the added unit tests, CI is passing

@den-run-ai
Copy link
ContributorAuthor

@filmor@tonyroberts@vmuriart please review the added unit tests, CI is passing

Assert.IsNotNull(module, ">>> import PyImportTest.test.one # FAILED");
PyObject module1 = PythonEngine.ImportModule("PyImportTest.test.one");
Assert.IsNotNull(module1, ">>> import PyImportTest.test.one # FAILED");
PyObject module2 = PythonEngine.ImportModule("PyImportTest.sysargv");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this should be its own test, not part of the previous one.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

agreed, let me move it

"""Test sys.argv state."""
argv = list(sys.argv) # need to make a copy of list
import clr
self.assertTrue(argv == sys.argv)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this doesn't make sense. Did importingclr previous causesys.argv to change? Other testsimport clr before this test, that may change being too.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this is to ensure that importing clr does not mess sys.argv, when it is not empty. what do you mean by "that may change being too."?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I have no idea what I was trying to write... I meant to say, that since other tests are doingimport clr before this test, the library is already loaded into memory and won't be reimported and theimport clr statement may do nothing.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

oh, that is a great point! then this needs to be the first test in the test runner before clr is loaded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

clr is loaded before all tests being. its the 5th line onrun_tests.py i think.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this was missed, still importing clr before setargv test

@vmuriartvmuriart merged commit79eeb61 intomasterFeb 8, 2017
@vmuriartvmuriart deleted the setsysargv branchFebruary 8, 2017 17:44
@vmuriart
Copy link
Contributor

Just applied the changes needed and squash merged since the history was a bit messy.


def test_sys_argv_state(self):
"""Test sys.argv state doesn't change after clr import."""
argv = sys.argv
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

should be argv = list(sys.argv) - need to make a copy

AlexCatarino added a commit to QuantConnect/pythonnet that referenced this pull requestJun 1, 2017
* Sanitize how to run tests* Remove unsupported entry points* Adds reference to Python.Test by default for all tests* Remove redundant add_reference* Avoid some implicit AddReferences that were being doneNot all tests added reference to Python.Test consistently. Solve this by making `run_test` the only supported method.* Remove dependency on sixRemove six.u(...), six.b(...)Not needed since dropped older python versions* Clean-up imports- Fix py2/py3 range/zip behavior  - Ensure same functions being used- Fix Exception/System.Exception name clashes* Fix nameclash object* Refactor utility functions* Rename tests* Refactor assertRaisestest_exceptions: Add exc_info test & fix Exception nameclash* Format for pep8 and lintersFix max min nameclash* Fix tests comparison to None, True, False, isinstance- Replace type(()) with tuple to clarify intent* Rename test fixturesCan mess with test discovery* Remove unused `using` from testing and format* Use unittest.skip(...)* Cleanup testing format* XML Docs on test fixtures* Update CHANGELOG* Implement Py.SetArgv.* Add a `Py.Throw` function.Checks whether an error occurred and in case it has throws aPythonException.* Add overload for Initialize to pass specific args.* Allow the engine to be initialized as a Disposable.* Use Py.Throw in a few more places.In particular in Py.Import.* Add PY3.7 to travis with allow_failure* Format & Whitespace*.cs linelength 120Allman* Update CHANGELOG* Change applicable comments to xml-docs* Update API website on docs & fix section headersRuntime.cs section headers got changed to docs.* Alias root.pyHandle to py_clr_module* Syntax cleanup* Simple classes cleanup (pythonnet#348)* Standarize properties used across projectsConsole had it owns set of properties going on* Add pyproj from @denfromufaCorrected the configs, won't interfere with users without PTVS* Consolidate output pathshttp://stackoverflow.com/questions/30191387/what-are-the-consequences-of-setting-same-output-path-for-all-configurations* Fix clrmodule config mismapping* Add PY3 project/sln configs* Update test PyImport pathChanged when consolidate output paths* Update runtime.csproj* Documentation clean-up* Downgrade to nunit2* Syntax cleanup* Update CHANGELOG* Clarify pynetinit.c, runtime build directivespynetinit.c:Clarifiy its intent is for PY3runtime.csRemove unnecessary check for System.TextSimplifies import section* Whitespace converter.cs* Propercase AssemblyInfo* Refactor nativemethods* Rename `is32bit` to `Is32Bit` for naming consistency* Replace UCS2/UCS4 build directive with Runtime.UCS* Add IsPython2 and IsPython3* Cleanup runtime config* Remove extra properties/Organize properties* Refactor property conditions* Order Runtime.csproj configurationTo make it easier to verify everything is setup correctlySimplified the Mono.Unix include condition* Add pylong lost unit testWasn't being referenced in the project* Replace #if DEBUG with conditional attribute* Fix and disable StrongNameSigningIt works better if they key is in the right folder and its being referenced when signing.It breaks InternalsVisibleTo though, disabling till have time to look into it. (not that it was actually enabled)* Fix debug statement & rename debugprint* Document nPython/Console usageClosespythonnet#358* Quiet Test Fixture build warnings about unused events.They will be used (or attempted to be used) from Python.* Mono dependency removed from Linux build.* Remove mono dependency from PY2 as well.* Replace bufLength with size* Remove arch .il files* Update CHANGELOG* Remove Mono.Unix reference from projectRemove duplicate property in Python.Test* Clean-up deprWarning* Clean-up attribute names and paranthesis* Use explicit accessors* Clean-up code-styleRemove redundant parenthesis, enforce brackets, use keywork types.* Remove obsoleted & Unenforced PermissionSetSee:http://stackoverflow.com/questions/11625447/securityaction-requestminimum-is-obsolete-in-net-4-0* Add expire to license shieldGithub Cache issuegithub/markup#224* Remove usage of #regionIt hides away the code in Visual Studio* Turn on NUNIT exit code* Fix GC on PyObject during FinalizingSimilar to how `PythonDerivedType` finalizes.Closespythonnet#364Possibly related topythonnet#245* Update CHANGELOG* Add sys.args tests (pythonnet#301)* Use NUnit from Nuget to ensure right version.* Simplify Embedded tests & Add new tests (pythonnet#369)* Add Tuple tests* Update AppVeyor comments and show when tests start.* Rename InitializeTest to pyinitializeKeep consistent with other test classes.* Simplify embed_testsSince the previous bug involving initialize/finalize have been solved,we can confidently upgrade these test to use simpler format.Also Remove Assert fail messagesNUnit already says the name of which test failed.* Add e-mail to remove setup.py warnings* Update NUnit syntaxUse xUnit2 and nUnit3 friendly syntax* Use string interpolationRemoved extra newline at beginning from deprecation warning message* Replace PyString_FromStringAndSize usage to PyString_FromString* Fix xml-docs build warnings* Refactor AppVeyor/Travis embedded test_runnerMake it easier to diff and upgrade versions bybreaking into multiple lines and using path completionPowershell continuation:http://stackoverflow.com/a/2608186/5208670Powershell options splatting:http://stackoverflow.com/a/24313253/5208670* Add pytest to CIpytest on travis initially required `sudo=required` otherwise failed.Without the sudo flag pytest wasn't being upgraded. Needed to forceupgrade.pytest-dev/pytest#2240* Convert unittest to pytestNeeds local imports to work.Conversion done with unittests2pytests and a couple regex* Add setup.cfgControl settings for some add-ons like pytest* Simpler tox* Upgrade NUnit to 3.6* Fix coverage w NUnit3; add OpenCover filterNUnit3/OpenCover behavior changed.Filter removes coverage from Embedded test files byfocusing only on types of Python.Runtime.** Remove check-manifest* Add overload tests frompythonnet#131* Refactor converter.cs & methodbind*.cs (pythonnet#375)* Cleanup/Comment Python.Runtime.dll.config & travisWe don't need the `*.dll` variant since we don't call for thosein `runtime.cs`Enable embedded tests on travis* Add LD_LIBRARY_PATH to travis envFind dlls for embedded tests on PY3* Find dll for PY2 travis embedded testsCopy Python.Runtime.dll.config to embedded tests bin output* Generalize LD_LIBRARY_PATHAvoid having to manually update python/travis versions* Add GetPrecedence reference* Use builtin miniconda* Update version (pythonnet#379)* Update setup.py* Update clr.py* StackOverflow/Slack shields (pythonnet#384)Add StackExchange and Slack shieldsShields got too long for a single line, had to break them up into two lines.One for build/quality status, the other for social/info.Add regression number to disabled code.* Slack integration for Travis and Appveyor (pythonnet#386)* Add Slack integration for Travis* Use encrypted string for Travis.* Add hook for Appveyor.* Simplify LD_LIBRARY_PATH on TravisBased from:http://stackoverflow.com/a/24115039/5208670Moved to own section to separate as a prep-enviroment step* Rename NUnit vars to generic namesMakes it easier to switch test-runners in the future.Note the if section is being skipped for NUnit3, but leaving itin case needed to rollback to NUnit2, or upgrade to XUnit* Remove python test STDERR redirectPytest doesn't need stderr redirect. It behaves* Clean-up AppVeyor build recipeConda automatically updates when doing install. To disable its autoupdate add    conda config --set auto_update_conda False* Add requirements.txt and pytest optionsPytest options provide summary for skipped/xfailed testsand adds color on appveyor* Quiet sdist output & update comments on AppVeyor* Add pytest header info & remove unused fixturesFixtures came from a different project and I forgot to delete them.Add custom header to gather environment info with test results.Remove testdir from pythonpath. pytest handles this on conftest.py* Move Conda env to PowerShell recipe scriptPY_VER removes the `.` it is used on appveyor_build_recipe.ps1* Use Codecov report flagsUpgrade to Codecov v2.0.6, didn't get released to PyPi.* Clean-up CI configs* Update CHANGELOG* Pass arbitrary .NET object as value of an attr of PyObject by dyn type(pythonnet#373)* Add Coverity badge* Clean-up CHANGELOG* Standardize Python.Test fixture locationEnsures that Python.Test is output to same location on both Linux and Windowsas part of build..gitkeep to be ensure folder is part of version control.Can be removed if any file is added to it.* Add unittest for Overflow/across AppDomains Exceptions reproduction (pythonnet#393)First exception shows issue frompythonnet#376* Re-order Initialize tests* Add documentation and ref to ReInitialize test* Split and re-order TestPyTupleIsTupleType test* Skip PyTuple test with AppDomain issueThis skip removes the issue from all PY3 on Travis/AppVeyor.PY27 still has issue randomly on both Travis/AppVeyor x86, x64,.* Clean-up embedded testsClean-up embedded tests comments and variable typesRemove TestFixture attribute. Optional since NUnit 2.5https://nunit.org/index.php?p=testFixture&r=2.6.4* Fix conda build log stderr->stdoutRecent conda-build update added a new log output to log:info.Powershell interprets this as an ERROR since its on STDERR.Prevent accidental auto-update & display INFO before building.Would have made debugging this psudo-error easier.* Quiet AppVeyor pip/nuget installsReduce verbosity to make relevant information easier to find.Errors and Warnings are still displayed.Travis doesn't need this since they have log folding.* Allow private env:var to force conda buildTo trigger conda build, just add/update private env:vars FORCE_CONDA_BUILDon link below. Easier to debug and no need to edit appveyor yml/ps1https://ci.appveyor.com/project/USER_NAME/pythonnet/settings/environment* Update AUTHORSAdd names to a few more contributors* Rename TearDown to DisposeEasier for future possible migration to other frameworks* Relocate Embedded tests fixturesEach test type should contain its own fixtures.Reduces weird dependency of each testing framework* Update LICENSE year & include in recipe* Update conda-recipe versionGet it from recipe file instead of git-tag.* Add SharedAssemblyInfo & Update Assembly versionReset version back down to v2.x from v4.0.0.2See link below for Semanctic Versioning & .NEThttps://codingforsmarties.wordpress.com/2016/01/21/how-to-version-assemblies-destined-for-nuget/* Add .bumpversionConfiguration based from gh:bumpversion:issues:77#issuecomment-130696156Usage:bumpversion major -> increases major and adds `dev` if not presentbumpversion minor -> increases minor and adds `dev` if not presentbumpversion release -> drop the `dev` portion* Add object overload test* Add object type to methodbind* Add more object overload method tests* Update CHANGELOG* Enable embedded_tests to Travis w. conditional filtersAdd conditional class skip to pytuple for Travis/PY27Add individual filters to other tests as neededhttps://www.amido.com/code/conditional-ignore-nunit-and-the-ability-to-conditionally-ignore-a-test/http://stackoverflow.com/a/16075029/5208670* Split blank DefineConstants on `*.csproj`Visual Studio by default wants to split these.Any time the csproj is update (new test for example) it splits them.Splitting them now to not worry about them when reviewing pull_requests.* Update CHANGELOG* Fix PythonException GC (pythonnet#400)Since PythonException doesn't inherit from PyObject, need to reapplythe same fix as from gh:365.Seen mostly on PY27/Travis on PyTuple tests.Enable PyTuple tests for PY27/Travis* Add Eval(...) and Exec(...)* Keep RunString Public. Fix Assert.AreEqual order-  Deprecation/Removal should be a separate issue/pr-  In NUnit/XUnit, expected is the first argument, actual is second. Opposite to how Python does it* Update CHANGELOG* Clarify MashalAs on runtime.cs- Shorten MarshalAsAttribute name- Put MashalAs'ed argument on own-line- Flip IF comparison* Fix runtime Initialize dll nameclashLooks like dllLocal never changes from IntPtr.Zero* Update test_sysargvPrevious version didn't test correctly* Fix the issue of sys.argv being cleared on import clr.Closespythonnet#404.* improve tests.pyproj for intellisense and running tests (pythonnet#395)* Update tests.pyproj* Update folder structureAfter pytest folders were flatten.Add code in fixtureUpstream PyImportTest was moved to within Embedded TestsAdd pyproj to editorconfig* Add case-sensitivity testscloses#81* Added branching for ldd command in OSX (pythonnet#406)* Minor style clean-up runtime/pythonengineAdd missing bracketsOrganize using/remove unusedAlign arguments* Fix Py_Main/PySys_SetArgvEx(...) UCS4/PY3 no memBased on@dmitriyse work on:dmitriyse@8a70f09* Update CHANGELOG, remove extra MarshalAs* Move PythonBuildDir when not definedKeep root of solution cleanand out of the way from being imported because its on the `cwd`.* Update ARCH checkUse sys for x86/x64  check* Enable TestPyTupleInvalidAppend test`AppDomain unload` was solved bypythonnet#400.Closespythonnet#397.Possibly also solvedpythonnet#245.* Add tests/refactor existing* Set language version to 6Prevent accidental introduction of csharp 7 features.* Add ICustomMarshaler StrMarshalerUseful resourceshttps://msdn.microsoft.com/en-us/library/system.runtime.interopservices.icustommarshaler(v=vs.110).aspxhttps://limbioliong.wordpress.com/2013/11/03/understanding-custom-marshaling-part-1/https://github.com/mono/mono/blob/master/mcs/class/Mono.Posix/Mono.Unix/UnixMarshal.cshttp://stackoverflow.com/a/33514037/5208670* Add ICustomMarshaler StrArrayMarshaler* Refactor Marshals* Add ICustomMarshaler Utf8MarshalerRefactor PyString_FromStringAndSizeLink explains why `MarshalAs(UnmanagedType.LPWStr)` or `CharSet.Unicode` don't workhttp://stackoverflow.com/a/25128147/5208670* Match PyUnicode_AsUnicode signature in UCS2/UCS4* Refactor GetManagedString* Remove internal PyUnicode_AS_UNICODEIts redundant with PyUnicode_AsUnicode now that the signatureis fixed between UCS2/UCS4.Apply char conversion that work on both UCS2/UCS4* Refactor Encoding checkThis won't change during runtime.* Remove ExactSpellingNot needed as Python doesn't define character specific functionshttps://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.exactspelling(v=vs.110).aspx* Remove CharSet.AnsiIts default charset usedhttps://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.charset(v=vs.110).aspx#Anchor_1* Remove CharSet.Unicode where not neededCharSet.Unicode is only needed when args are string type.https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.charset(v=vs.110).aspx* Remove CallingConvention* Rename Runtime field `dll` to `PythonDll`Add remove full qualification* Remove unneeded unsafe keyword* Update CHANGELOG* Add Runtime.CheckExceptionOccurred(...)Helps refactor exceptions checks* Replace Py.Throw with Runtime.CheckExceptionOccurred* Whitespace clean-up Runtime* Apply consistent name qualification to runtime.cs* Unify PY3 UCS2/UCS4 unicode methodsCustomMarshal implementation deals w UCS2/4 differences* Unify PY2 UCS2/UCS4 unicode methodsPyUnicodeEntryPoint is not used for PY3since it was unified by PEP393.It could be defined as "PyUnicode_" for PY3 and further unify the codebetween PY2/PY3. Not implementing since not all PY3 methods exist in PY2* Rename internal methods to proper Python API name- PyUnicode_FromKindAndString to PyUnicode_FromKindAndData- PyString_AS_STRING to PyString_AsString* Fix PY27 dll mapping in Linux/macOSOn5062377 this was fixed for PY3but left unchanged for PY2.On linux/macOS the library is aliased `python2.7` while in windows its `python 27`.Since internally it wasn't mapped to the correct library in Linux/macOS, we had toremap it again using the dll.config file.Closespythonnet#120* Refactor runtime's dllBaseAs long as the API doesn't change on new python minor releases,all changes needed for new minor versions is isolated to a smallsection of code.* Style clean-up runtime.cs* Temporary disable Codecov flagsCodecov added a limit of 20 uploads due to current on-going bughttps://docs.codecov.io/blog/week-8-2017Also fixed flags casing, documentations says has to be lowercase.* Fix test_multiple_calls_to_initializeException check didn't upgrade syntax from unittests.Didn't cause issues because test was passing.* Fix PythonEngine.VersionAdd TestPythonEngineProperties.Ensure PythonEngine properties are working correctly.Currently only work on 32bit machines.Closespythonnet#413* Add PYTHONPATH/PYTHONHOME default value testsCurrent tests crash on 64bit python on windows, and resultsget truncated on Linux.When working, PYTHONHOME should match ENV VAR if set.AppVeyor has been updated to test against not blank* Fix get PYTHONHOME/PYTHONPATH marshalUnlikepythonnet#413, the return type changes between PY2/PY3.Extended Custom Marshaler to convert IntPtr to Unicode String* Rename internal StrMarshaler to UcsMarshalerTo clarify that this is meant to be applied on Unicode type IntPtr and not strings like ones.Made Marshalers internal, don't see a reason to expose it.* Unset PYTHONHOME in AppVeyorIts messing with `conda` causing it to fail to start.Tests in the `pr`pythonnet#415 make this unnecessary.* Update condaUpdate to using conda based on PY36.Remove reference to deleted `dll.config` file* Fix PythonEngine PYTHONHOME setterKeep memory reference & fix PY3 marshal* Fix set PythonPath, set ProgramNameNote on PythonPath. Its actually mapping to `Py_SetPath` which isvery different from PYTHONPATH env var. There is no test on itbecause it should be set to real paths with libraries. Otherwise itcrashes.2nd Note. `Py_SetPath` doesn't exist on PY27.* Deprecate public RunStringHad to remove defaults to disambiguate call on `internal RunString`.Can re-add after removing `public RunString`Closespythonnet#401* Combine Py_DEBUG and PYTHON_WITH_PYDEBUG flagsThey both refer to the PyDebug builds but were added at different times.Closespythonnet#362* Remove PYTHON_WITH_WIDE_UNICODE flagABIFlags were introduced in PY32, and --with_wide_unicode was removed in PY33.https://docs.python.org/3/whatsnew/3.3.html#functionalityClosespythonnet#417* Refactor PY2/PY3 Marshal in/out String/Unicode* Refactor runtime.cs* Fix Py_SetPath not available in PY2Closespythonnet#418* Calculate Runtime fields before Initialization* Add timing to detect slow tests on pytest* Rename test classes/filesMake it easier to distinguish if editor tab refers to class or test.* Add PyTuple Ctor tests* Define and document Py_IncRef/Py_DecRef* Add Tests* Refactor Exception checking on tested classes* Clean-up Embedded tests* Add PyList tests* Add test for pyscript global variable castingTest forpythonnet#420* Clean-up README.md example* Fix typo in README* Update CHANGELOG.md* Bump version: 2.3.0.dev1 → 2.3.0 release* Bump version: 2.3.0.→ 2.4.0.dev0Can't start at dev1 as bumpversion breaks if we add a minimum start version for dev.* Build conda recipe on new tagsEnsure that new binaries are generated for releases which are usually not from pull_requests.Using APPVEYOR_REPO_TAG_NAME because yields shorter syntaxbecause it's undefined (ie false) when not a tagand APPVEYOR_REPO_TAG has to be compared to lowercase `true` insteadof `True` like everything else.Definitions:APPVEYOR_REPO_TAG_NAME - contains tag name for builds started by tag; otherwise this variable is undefined;APPVEYOR_REPO_TAG - true if build has started by pushed tag; otherwise false;https://www.appveyor.com/docs/environment-variables/* Fix numpy array and README example (pythonnet#427)* Fix numpy array and README exampleGeneric Lists were falling through and being classified as `typecode.Object`To solve this, adding a specific processing branch for `Generic Lists` onlyto avoid breaking the changes from471673aClosespythonnet#249* Update syntax* Msbuild15 patch (pythonnet#435)* Update AUTHORS.md* Update CHANGELOG.md* Update setup.py* Update bld.bat* Create .mention-bot* WPF DynamicGrid python and XAML layout files (pythonnet#280)* Support clr.GetClrType() - as in IronPython (pythonnet#433)* Support clr.GetClrType() - as in IronPythonImplementspythonnet#432* Tests for clr.GetClrType()* clr.GetClrType test: ensure bad type raises ArgumentException* clr.GetClrType - added xml doc comment, updated AUTHORS.md and CHANGELOG.md* Simplified implementation of clr.GetClrType (taken from IronPython)* Update .mention-bot* Update .mention-bot* Re-add CallingConventionClosespythonnet#448* Allow passing None for nullable args (pythonnet#460)* Updated CHANGELOG and AUTHORS (pythonnet#462)* Fixing Travis CI for mono 5.0 (pythonnet#471)* Fixing setup.py with mono 5.0* Go back to xbuild* Trying to figure out the error cause. Apparently xbuild cannot process the Copy section of the pdb file in the projects.I have commented them out for now, but this is not a real soltion since they are needed in debug versions. Just to se if it fixes the CI.* Implement named arguments and With semantics in C# embedding side (pythonnet#461)* Added python "with" construction* Added some unit tests for new With method* Renamed With tests for easier grouping* Support for named arguments to invoke python methods* Named argument tests cosmetic changed* Fixed failing test in python 2.7* Reset line endings in csproj to LF* Implements Decimal and Datetime support
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vmuriartvmuriartvmuriart approved these changes

@filmorfilmorAwaiting requested review from filmor

@tonyrobertstonyrobertsAwaiting requested review from tonyroberts

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@den-run-ai@tonyroberts@filmor@vmuriart

[8]ページ先頭

©2009-2025 Movatter.jp