Skip to content

Commit

Permalink
Deprecate pybind11_abseil/status_caster.h, adjust IWYU pragmas accord…
Browse files Browse the repository at this point in the history
…ingly.

The header was meant to be deprecated for >1 year, but this was not documented.

Also adopt the

```
// IWYU pragma: always_keep // See pybind11/docs/type_caster_iwyu.rst
```

comment used in google/pybind11clif#30073.

Currently pybind11/docs/type_caster_iwyu.rst only exists in google/pybind11clif#30073, but the intend is to upstream the changes (see PR description).

See also: https://clangd.llvm.org/design/include-cleaner

PiperOrigin-RevId: 578314470
  • Loading branch information
Ralf W. Grosse-Kunstleve authored and copybara-github committed Oct 31, 2023
1 parent 4b883e4 commit 2ed475d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 26 deletions.
4 changes: 1 addition & 3 deletions pybind11_abseil/absl_casters.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
//
// Author: Ken Oslund

// This header declares template specializations, and thus its use may
// not be visible to inclusion analysis tools, but we must retain it.
// IWYU pragma: always_keep
// IWYU pragma: always_keep // See pybind11/docs/type_caster_iwyu.rst

#ifndef PYBIND11_ABSEIL_ABSL_CASTERS_H_
#define PYBIND11_ABSEIL_ABSL_CASTERS_H_
Expand Down
3 changes: 3 additions & 0 deletions pybind11_abseil/status_caster.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Author: Ken Oslund (kenoslund@)

// IWYU pragma: always_keep // See pybind11/docs/type_caster_iwyu.rst

#ifndef PYBIND11_ABSEIL_STATUS_CASTER_H_
#define PYBIND11_ABSEIL_STATUS_CASTER_H_

Expand Down
27 changes: 4 additions & 23 deletions pybind11_abseil/status_casters.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
// Type conversion utilities for pybind11 and absl::Status/StatusOr.
//
// Usage:
// 1) Include this file in the .cc file with your bindings.
// 2) Call `pybind11::google::ImportStatusModule()` in your PYBIND11_MODULE
// definition.
//
// Supported types:
// - absl::Status- converts a non-ok return status into a python exception.
// Can be passed as an argument too if you import the status pybind module.
// - absl::StatusOr- converts a non-ok return status into a python exception,
// otherwise converts/returns the payload. Can only be used as a return value.
//
// For details, see the README.md.
//
// Author: Ken Oslund (kenoslund@)

// This header declares template specializations, and thus its use may
// not be visible to inclusion analysis tools, but we must retain it.
// IWYU pragma: always_keep
// DEPRECATED: Please prefer including the headers below directly.

#ifndef PYBIND11_ABSEIL_STATUS_CASTERS_H_
#define PYBIND11_ABSEIL_STATUS_CASTERS_H_

#include "pybind11_abseil/status_caster.h" // IWYU pragma: export
#include "pybind11_abseil/statusor_caster.h" // IWYU pragma: export
#include "pybind11_abseil/import_status_module.h" // IWYU pragma: export
#include "pybind11_abseil/status_caster.h"
#include "pybind11_abseil/statusor_caster.h"
#include "pybind11_abseil/import_status_module.h"

#endif // PYBIND11_ABSEIL_STATUS_CASTERS_H_
3 changes: 3 additions & 0 deletions pybind11_abseil/statusor_caster.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Author: Ken Oslund (kenoslund@)

// IWYU pragma: always_keep // See pybind11/docs/type_caster_iwyu.rst

#ifndef PYBIND11_ABSEIL_STATUSOR_CASTER_H_
#define PYBIND11_ABSEIL_STATUSOR_CASTER_H_

Expand Down

0 comments on commit 2ed475d

Please sign in to comment.