Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a GitHub Action to find typos with codespell #466

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This Action looks for typos in the codebase using codespell
# and provide users with intuitive GitHub Annotations.
# https://github.com/codespell-project/codespell#readme
name: codespell
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
2 changes: 1 addition & 1 deletion README-gdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Enable `python-gdb.py`
----------------------

`python-gdb.py` is a GDB script to make it easier to inspect the state of a
Python process from whitin GDB. It is documented
Python process from within GDB. It is documented
[in the CPython's dev guide](https://devguide.python.org/gdb/).

The script add a series of GBD commands such as:
Expand Down
8 changes: 4 additions & 4 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog
Version 0.9 (April 25th, 2023)
------------------------------

This release adds numerous major features and indicates the end of HPy's *alhpa*
This release adds numerous major features and indicates the end of HPy's *alpha*
phase. We've migrated several key packages to HPy (for a list, see our website
https://hpyproject.org) and we are now confident that HPy is mature enough for
being used as serious extension API. We also plan that the next major release
Expand Down Expand Up @@ -56,7 +56,7 @@ HPy :ref:`porting-guide:calling protocol`
convention. This is: the arguments are passed in a C array and the keyword
argument names are provided as a Python tuple. Before this release, the only
way to create a callable type was to set the special method ``__call__``.
However, this has several disadvantages. In particlar, poor performance on
However, this has several disadvantages. In particular, poor performance on
CPython (and maybe other implementations) and it was not possible to have
specialized call function implementations per object (see
:c:func:`HPy_SetCallFunction`)
Expand Down Expand Up @@ -117,7 +117,7 @@ Documentation
* Added :doc:`quickstart` guide
* Extended :doc:`api-reference/index`
* Added :doc:`api-reference/function-index`
* Added possiblity to generate examples from tests with argument ``--dump-dir``
* Added possibility to generate examples from tests with argument ``--dump-dir``
(see :ref:`api:hpy unit tests`)
* Added initial :doc:`contributing/index` docs

Expand Down Expand Up @@ -206,7 +206,7 @@ Debug mode:
Misc Changes:

- Removed unnecessary prefix ``"m_"`` from fields of ``HPyModuleDef`` (incompatible change)
- For HPy implementors: new pytest mark for HPy tests assuming synchronous GC
- For HPy implementers: new pytest mark for HPy tests assuming synchronous GC

Version 0.0.3 (September 22nd, 2021)
------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Benefits for the Python ecosystem
The HPy project offers some benefits to the python ecosystem, both to Python
users and to library developers.

- C extensions can achieve much better speed on alternative implementions,
- C extensions can achieve much better speed on alternative implementations,
including PyPy and GraalPy: according to early :ref:`benchmarks`, an
extension written in HPy can be ~3x faster than the equivalent extension
written using ``Python.h``.
Expand Down
2 changes: 1 addition & 1 deletion hpy/devel/include/hpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ extern "C" {
*
* * In Universal-ABI mode, they always resolve to an indirect call
* through ``HPyContext *``, i.e. ``ctx->ctx_Add(...)``, which on CPython
* dispaches to ``ctx_Add``.
* dispatches to ``ctx_Add``.
*/
#define HPyAPI_FUNC _HPy_UNUSED static inline

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[build-system]
requires = [ "setuptools>=64.0", "setuptools-scm[toml]>=6.0", "wheel>=0.34.2",]
build-backend = "setuptools.build_meta"

[tool.codespell]
ignore-words-list = "acount,crate,fo,ois,ot,seh"
2 changes: 1 addition & 1 deletion test/debug/test_charptr.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def test_charptr_correct_usage(compiler):
@EXPORT(f)
@INIT
""")
assert mod.f('I wont be leaked!') == 'I wont be leaked!';
assert mod.f('I will not be leaked!') == 'I will not be leaked!';


def test_charptr_limit_stress_test(compiler):
Expand Down
10 changes: 5 additions & 5 deletions test/debug/test_context_reuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_reuse_context_from_global_variable(compiler, python_subprocess):
return HPy_Dup(ctx, ctx->h_None);
}
HPy_Close(ctx, t);
fprintf(stdout, "Heavy Marmelade\\n");
fprintf(stdout, "Heavy Marmalade\\n");
fflush(stdout);
// Here we wrongly use "keep" instead of "ctx"
return HPy_Dup(keep, ctx->h_None);
Expand Down Expand Up @@ -65,13 +65,13 @@ def test_reuse_context_from_global_variable(compiler, python_subprocess):
result = python_subprocess.run(mod, code)
assert result.returncode != 0
assert b"Error: Wrong HPy Context!" in result.stderr
assert result.stdout == b"Heavy Marmelade\n"
assert result.stdout == b"Heavy Marmalade\n"

code = "mod.f(); mod.bounce(lambda: mod.g())"
result = python_subprocess.run(mod, code)
assert result.returncode != 0
assert b"Error: Wrong HPy Context!" in result.stderr
assert result.stdout == b"Bouncing...\nHeavy Marmelade\n"
assert result.stdout == b"Bouncing...\nHeavy Marmalade\n"

# checks the situation when the context cache runs out,
# and we start reusing cached contexts
Expand All @@ -91,12 +91,12 @@ def test_reuse_context_from_global_variable(compiler, python_subprocess):
HPY_DEBUG_CTX_CACHE_SIZE = 16
for size in range(HPY_DEBUG_CTX_CACHE_SIZE-1, HPY_DEBUG_CTX_CACHE_SIZE+2):
result = python_subprocess.run(mod, code.format(size))
assert result.stdout == (b"Bouncing...\n" * size) + b"Heavy Marmelade\n"
assert result.stdout == (b"Bouncing...\n" * size) + b"Heavy Marmalade\n"
if result.returncode != 0:
assert b"Error: Wrong HPy Context!" in result.stderr

code = 'mod.keep_and_bounce(lambda: mod.g())'
result = python_subprocess.run(mod, code)
assert result.returncode != 0
assert b"Error: Wrong HPy Context!" in result.stderr
assert result.stdout == b"Bouncing differently...\n" + b"Heavy Marmelade\n"
assert result.stdout == b"Bouncing differently...\n" + b"Heavy Marmalade\n"
Loading