GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-91338: Ensure test_ucnhash_capi_reset doesn't pass PYTHONHOME to _testembed.exe by neonene · Pull Request #32313 · python/cpython

Conversation

@neonene

@neonene neonene commented Apr 4, 2022 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

A minor tweak for Windows. _test_embed.exe fails to import *.pyd modules when the initialization is repeated with PYTHONHOME from python.bat.

>python.bat -m test test_embed -v

======================================================================
FAIL: test_ucnhash_capi_reset (test.test_embed.EmbeddingTests.test_ucnhash_capi_reset)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\cpython\Lib\test\test_embed.py", line 349, in test_ucnhash_capi_reset
    out, err = self.run_embedded_interpreter("test_repeated_init_exec", code)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\cpython\Lib\test\test_embed.py", line 117, in run_embedded_interpreter
stdout:
9

stderr:
--- Loop #1 ---
--- Loop #2 ---
  File "<string>", line 1
    print('\N{digit nine}')
                          ^
SyntaxError: (unicode error) \N escapes not supported (can't load unicodedata module)

sys.path at Loop#1 has the build directory, which is replaced with f"{PYTHONHOME}/DLLs" at the next loop. The behavior looks realistically designed.

GitHub CI machines doesn't show the error, using rt.bat where PYTHONHOME is not set.

https://bugs.python.org/issue47182

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@neonene
Remove PYTHONHOME from envvars
7aa2505
@bedevere-bot bedevere-bot added the awaiting review label Apr 4, 2022
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Apr 4, 2022
@bedevere-bot bedevere-bot added the tests Tests in the Lib/test dir label Apr 4, 2022
@tiran tiran added the skip news label Apr 4, 2022
tiran
tiran approved these changes Apr 4, 2022
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Apr 4, 2022
@tiran

tiran commented Apr 4, 2022

Copy link
Copy Markdown
Member

Looks good to me!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@neonene

neonene commented Apr 23, 2022

Copy link
Copy Markdown
Contributor Author

@zooba, could you take a look at this?
I'll close if unnecessary.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zooba

zooba commented Apr 25, 2022

Copy link
Copy Markdown
Member

We have a few other tests that use the same function. I'd assume we either need to update all of them (because they're all "wrong", even if they're not triggering it yet), or make sure that the values aren't regenerated differently.

Do we know the root cause of the changed value?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

neonene added 2 commits April 26, 2022 23:33
@neonene
Merge branch 'python:main' into nohome
197cf51
@neonene
patch for test_repeated_init_exec
d3bff23
@neonene neonene changed the title bpo-47182: Ensure test_ucnhash_capi_reset doesn't pass PYTHONHOME to _testembed.exe gh-91338: Ensure test_ucnhash_capi_reset doesn't pass PYTHONHOME to _testembed.exe Apr 26, 2022
@neonene

neonene commented Apr 26, 2022

Copy link
Copy Markdown
Contributor Author

Holding the value of platstdlib_dir for getpath.py would fix the root cause.
My implementation was modifying PyConfig and _PyPathConfig structures.
This PR (updated) is less risky for me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@neonene

neonene commented Apr 27, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Do we know the root cause of the changed value?

I'll close this and open an issue, considering that the current behavior, which I think is practical, may be unintentional.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@neonene neonene closed this Apr 27, 2022
@neonene
neonene deleted the nohome branch April 27, 2022 12:32
@neonene neonene mentioned this pull request Apr 27, 2022
getpath miscalculates sys.path from second initialization with PYTHONHOME on Windows #91985
Closed
@tiran tiran mentioned this pull request May 9, 2022
_PyUnicode_Fini should invalidate ucnhash_capi capsule pointer #91338
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@tiran tiran tiran approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting merge skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@neonene @tiran @zooba @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.